lib/ez/schema_modifier.rb in ez-1.2.0 vs lib/ez/schema_modifier.rb in ez-1.3.0
- old
+ new
@@ -84,11 +84,13 @@
if !db_col
if !assume_missing
display_change "Adding new column '#{col_name}' as #{col_type} for model #{model_name}"
end
- db.add_column(table_name, col_name.to_sym, col_type.to_sym, default: col_default) unless @dry_run
+ opts = { default: col_default }
+ opts[:limit] = data[:limit] if data[:limit]
+ db.add_column(table_name, col_name.to_sym, col_type.to_sym, opts) unless @dry_run
if data[:index]
display_change " (adding database index for '#{col_name}')"
db.add_index table_name, col_name.to_sym unless @dry_run
end
else
@@ -102,10 +104,12 @@
displayable_value = "NULL" if col_default.nil?
display_change "Applying new default value #{displayable_value} for #{col_name} for model #{model_name}"
end
if (db_col.type != col_type) || (db_col.default != col_default)
- db.change_column(table_name, col_name.to_sym, col_type.to_sym, default: col_default) unless @dry_run
+ opts = { default: col_default }
+ opts[:limit] = data[:limit] if data[:limit]
+ db.change_column(table_name, col_name.to_sym, col_type.to_sym, opts) unless @dry_run
end
end
end
end