Topic: SOLVED how to encapsulate SQL code in a migration file
I am trying to run SQL code when running a migration in order to create the columns of a table. I want to use SQL rather than rails code because the data types are more specific in MySQL than in rails.
create_table :ingredients do |t|
ALTER TABLE ingredients DROP id;
ALTER TABLE ingredients ADD id mediumint unsigned not null auto_increment key;
ALTER TABLE ingredients ADD name varchar(100) not null;
This code gets refused at SQL line 2, line 1 is not executed. Please help me understand why. Thanks.
Last edited by carrot06 (2012-04-08 16:16:53)