Support the ongoing development of Laravel.io →
Configuration Database
Last updated 1 year ago.
0

anyone? replying!

0

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?

0

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/n...

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/p...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

asimkh asimkh Joined 19 Jul 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.