This is what migrations do. You shouldn't be migrating and rolling back constantly though specially on a production application.
If you do roll back and you want to keep the data, instead of rolling back make a new migration that will house all the data that you are about to remove, and copy the data into that table, then do your drop column/tables/whatever..
But then again this is introducing another set of tables to handle your data...
Not really sure what you are doing but take some time and think about your database and it will cut down on the rollbacks you do, thus not losing data.
Make sense?
Im trying to add an extra field to one of my tables.
Ive added the field in the migration file (under db\migrate) then ran 'rake db:migrate' which ran without troubles and my text editor even told me my schema.db file has been updated and needs to refresh. https://www.gangboard.com/app-programming-scripting-training/nodejs-training
The schema file does not contain my new field and any attempts to reference the field from my views fail miserably.
How do I do this? It is possible to update a table with an extra field via rails without having to totally drop and recreate the database again? https://www.gangboard.com/app-programming-scripting-training/python-training
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community