@@ -3,29 +3,25 @@ module ConnectionAdapters #:nodoc:
3
3
# Abstract representation of an index definition on a table. Instances of
4
4
# this type are typically created and returned by methods in database
5
5
# adapters. e.g. ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#indexes
6
- class IndexDefinition < Struct . new ( :table , :name , :unique , :columns , :lengths , :orders , :where , :type , :using , :comment ) #:nodoc:
7
- end
6
+ IndexDefinition = Struct . new ( :table , :name , :unique , :columns , :lengths , :orders , :where , :type , :using , :comment ) #:nodoc:
8
7
9
8
# Abstract representation of a column definition. Instances of this type
10
9
# are typically created by methods in TableDefinition, and added to the
11
10
# +columns+ attribute of said TableDefinition object, in order to be used
12
11
# for generating a number of table creation or table changing SQL statements.
13
- class ColumnDefinition < Struct . new ( :name , :type , :limit , :precision , :scale , :default , :null , :first , :after , :auto_increment , :primary_key , :collation , :sql_type , :comment ) #:nodoc:
12
+ ColumnDefinition = Struct . new ( :name , :type , :limit , :precision , :scale , :default , :null , :first , :after , :auto_increment , :primary_key , :collation , :sql_type , :comment ) do #:nodoc:
14
13
def primary_key?
15
14
primary_key || type . to_sym == :primary_key
16
15
end
17
16
end
18
17
19
- class AddColumnDefinition < Struct . new ( :column ) # :nodoc:
20
- end
18
+ AddColumnDefinition = Struct . new ( :column ) # :nodoc:
21
19
22
- class ChangeColumnDefinition < Struct . new ( :column , :name ) #:nodoc:
23
- end
20
+ ChangeColumnDefinition = Struct . new ( :column , :name ) #:nodoc:
24
21
25
- class PrimaryKeyDefinition < Struct . new ( :name ) # :nodoc:
26
- end
22
+ PrimaryKeyDefinition = Struct . new ( :name ) # :nodoc:
27
23
28
- class ForeignKeyDefinition < Struct . new ( :from_table , :to_table , :options ) #:nodoc:
24
+ ForeignKeyDefinition = Struct . new ( :from_table , :to_table , :options ) do #:nodoc:
29
25
def name
30
26
options [ :name ]
31
27
end
0 commit comments