Skip to content

Commit bde7821

Browse files
authored
Merge pull request rails#47609 from Shopify/factor-out-column-def
Factor out the `valid_column_definition_options` method to AbstractAdapter class
2 parents 2d6ce96 + cdb8957 commit bde7821

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def new_check_constraint_definition(expression, options) # :nodoc:
586586

587587
private
588588
def valid_column_definition_options
589-
ColumnDefinition::OPTION_NAMES
589+
@conn.valid_column_definition_options
590590
end
591591

592592
def create_column_definition(name, type, options)

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,18 @@ def bulk_change_table(table_name, operations) # :nodoc:
14971497
non_combinable_operations.each(&:call)
14981498
end
14991499

1500+
def valid_table_definition_options
1501+
[:temporary, :if_not_exists, :options, :as, :comment, :charset, :collation]
1502+
end
1503+
1504+
def valid_column_definition_options
1505+
ColumnDefinition::OPTION_NAMES
1506+
end
1507+
1508+
def valid_primary_key_options
1509+
[:limit, :default, :precision]
1510+
end
1511+
15001512
private
15011513
def validate_change_column_null_argument!(value)
15021514
unless value == true || value == false
@@ -1595,14 +1607,6 @@ def create_alter_table(name)
15951607
AlterTable.new create_table_definition(name)
15961608
end
15971609

1598-
def valid_table_definition_options
1599-
[:temporary, :if_not_exists, :options, :as, :comment, :charset, :collation]
1600-
end
1601-
1602-
def valid_primary_key_options
1603-
[:limit, :default, :precision]
1604-
end
1605-
16061610
def validate_create_table_options!(options)
16071611
unless options[:_skip_validate_options]
16081612
options

0 commit comments

Comments
 (0)