Reputation: 6662
In migrations we can write in following way
t.integer :escalated_by, escalated_to, query_id
But I don't like this way.
Rather I would like something like code below:
def self.up
create_table :query_escalations do |t|
t.integer do
:escalated_by
:escalated_to
:query_id
end
t.timestamps
end
end
I think this is more readable. Does rails supports this way? or is there any way similar to this?
Upvotes: 0
Views: 169
Reputation: 38450
NO. Rails does not suppor that style. And if you want that style then you will have to do a lot of work.
Migration is complex piece of code. I will suggest to stick with what rails provides.
For what it's work up and down will be instance methods in Rails 3.1 instead of being class methods.
Upvotes: 1