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.
Rails what to write in drop_table down method
-
29-06-2023 - |
Pregunta
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!
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow