The command script/generate migrationdoes not create columns in new tables.
Only if you want to add, for example, a column to an existing table, you can pass a new column as an argument:
script/generate migration add_text_to_question question_text:string
For what you are trying to achieve, you need to create a new model:
script/generate model Question ordinal_label:string question_text:string
This will result in migration as follows:
class CreateQuestions < ActiveRecord::Migration
def self.up
create_table :questions do |t|
t.string :ordinal_label
t.string :question_text
t.timestamps
end
end
def self.down
drop_table :questions
end
end
source
share