Answer the question
In order to leave comments, you need to log in
How to update data-preserving migrations in Laravel?
During the development process, I update migrations, change the structure of the database.
But I'm obviously doing something wrong... update blows all the records to hell (
I have to do it manually... not comme il faut..
poke pliz into the docks how to do a correct update based on migration files?
Add a column there... or add unique if I missed it at the beginning, I'm
very grateful.
Answer the question
In order to leave comments, you need to log in
Check that the correct method is used in the migration file.
To create tables, use:
To update tables, use:
To generate a migration to update a table, you can use the command:
$ php artisan make:migration migration_name --table="table_name"
Updating without loss is impossible. But it’s quite realistic and easy to create new migrations every time you need to roll out updates: you create a new migration and then use Schema::table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question