1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #17798 from kamipo/refactor_visit_add_column

Refactor `SchemaCreation#visit_AddColumn`
This commit is contained in:
Yves Senn 2014-11-28 11:13:26 +01:00
commit f2d602b229
2 changed files with 1 additions and 9 deletions

View file

@ -15,9 +15,7 @@ module ActiveRecord
end
def visit_AddColumn(o)
sql_type = type_to_sql(o.type, o.limit, o.precision, o.scale)
sql = "ADD #{quote_column_name(o.name)} #{sql_type}"
add_column_options!(sql, column_options(o))
"ADD #{accept(o)}"
end
private

View file

@ -4,12 +4,6 @@ module ActiveRecord
class SchemaCreation < AbstractAdapter::SchemaCreation
private
def visit_AddColumn(o)
sql_type = type_to_sql(o.type, o.limit, o.precision, o.scale)
sql = "ADD COLUMN #{quote_column_name(o.name)} #{sql_type}"
add_column_options!(sql, column_options(o))
end
def visit_ColumnDefinition(o)
sql = super
if o.primary_key? && o.type != :primary_key