Question

I want to drop a table that has changed a few times (add columns, rename, add index..10 migration files) If I do:

def up
 drop_table :tablename
end

def down
 create_table :tablename do |t|
    t.string :string
    ...
 end
end

On the down method, do I have to include all the columns as they were in the last state of the table? Or will rails be smart enough to remember its last state?

Thanks!

Was it helpful?

Solution

rails is smart, but its not the job of rails to remember the state of the tables that were dropped. So you have to make sure that you create the table with the columns that you would expect at this state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top