aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-04-17 02:58:52 +0930
committerGitHub <noreply@github.com>2017-04-17 02:58:52 +0930
commite1e3be7c02acb0facbf81a97bbfe6d1a6e9ca598 (patch)
tree5640f0f52e7f19bc349abb3127cff6ea4437b305 /activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
parent01caad190f8f6aa1fe36f1cda764f22b6df72e22 (diff)
parent606830d27a32fab23c0964b4383807fcdfdd7eba (diff)
downloadrails-e1e3be7c02acb0facbf81a97bbfe6d1a6e9ca598.tar.gz
rails-e1e3be7c02acb0facbf81a97bbfe6d1a6e9ca598.tar.bz2
rails-e1e3be7c02acb0facbf81a97bbfe6d1a6e9ca598.zip
Merge pull request #28773 from kamipo/support_descending_indexes
Support Descending Indexes for MySQL
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
index 4682afc188..7cafbb7e12 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -3,7 +3,32 @@ module ActiveRecord
# Abstract representation of an index definition on a table. Instances of
# this type are typically created and returned by methods in database
# adapters. e.g. ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#indexes
- IndexDefinition = Struct.new(:table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using, :comment) #:nodoc:
+ class IndexDefinition # :nodoc:
+ attr_reader :table, :name, :unique, :columns, :lengths, :orders, :where, :type, :using, :comment
+
+ def initialize(
+ table, name,
+ unique = false,
+ columns = [],
+ lengths: {},
+ orders: {},
+ where: nil,
+ type: nil,
+ using: nil,
+ comment: nil
+ )
+ @table = table
+ @name = name
+ @unique = unique
+ @columns = columns
+ @lengths = lengths
+ @orders = orders
+ @where = where
+ @type = type
+ @using = using
+ @comment = comment
+ end
+ end
# Abstract representation of a column definition. Instances of this type
# are typically created by methods in TableDefinition, and added to the