Low sleep so probably missing something trivial, but…
Based on various doc readings, I thought that this would generate a migration with table and column declarations included…
$ script/generate migration Question ordinal_label:string question_text:string
However, the result is…
class Question < ActiveRecord::Migration
def self.up
end
def self.down
end
end
Why is there no table or columns?
The
script/generate migrationcommand does not create columns on new tables.Only if you wish add, for instance, a column to an existing table you can pass the new column as an argument:
For what you are trying to achieve you have to create a new model:
This will generate a migration like the following: