mysql - Adding defaults to integer columns, error saying 'right sytnax near 'default-1 default null' -
i have column named 'parent_id' trying add default of -1 to:
change_column :categories, :parent_id, :default => -1 the type integer in mysql.
i getting error:
'mysql2 error......'default-1 default null' @ line 1: alter table 'categories' change 'parent_id' 'parent_id' default-1 default null it seems missing = sign?
also, how do db:migrate on test db?
you're missing column type in change_column, should more this:
change_column :categories, :parent_id, :integer, :default => -1 the giveaway this: default-1. change_column method wants 3 arguments , hash of optional arguments. :default => -1 getting mashed column type because didn't specify :integer third argument.
Comments
Post a Comment