You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)")ifcolumn_names.empty?
53
-
ActiveSupport::Deprecation.warn'Passing array to remove_columns is deprecated, please use multiple arguments, like: `remove_columns(:posts, :foo, :bar)`',callerifcolumn_names.flatten!
54
-
column_names.flatten.eachdo |column_name|
55
-
remove_check_constraints(table_name,column_name)
56
-
remove_default_constraint(table_name,column_name)
57
-
remove_indexes(table_name,column_name)
58
-
do_execute"ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"
59
-
end
50
+
51
+
defremove_column(table_name,column_name,type=nil)
52
+
raiseArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)")if(column_name.is_a?Array)
53
+
ActiveSupport::Deprecation.warn'Passing multiple arguments to remove_columns is deprecated, please use just one column name, like: `remove_columns(:posts, :column_name, :type)`',callerifcolumn_name
54
+
remove_check_constraints(table_name,column_name)
55
+
remove_default_constraint(table_name,column_name)
56
+
remove_indexes(table_name,column_name)
57
+
do_execute"ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"
sql_commands << "CREATE INDEX #{quote_table_name(index.name)} ON #{quote_table_name(table_name)} (#{index.columns.collect{|c|quote_column_name(c)}.join(', ')})"
0 commit comments