D
D
dk-web2016-04-27 19:01:59
Laravel
dk-web, 2016-04-27 19:01:59

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

2 answer(s)
D
D', 2016-04-27
@Denormalization

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"

A
Alex Wells, 2016-04-28
@Alex_Wells

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 question

Ask a Question

731 491 924 answers to any question