A
A
Alexander Vladimirovich2020-03-13 10:06:27
MySQL
Alexander Vladimirovich, 2020-03-13 10:06:27

How to null or merge migrations and leave one?

Greetings!
There is a project on symfony4 + mysql
It has a standard folder with migrations Migrations There are a
lot of migrations themselves, several dozens.
How to make it so that there is only one migration left, from zero to the last current state?
In this case, no data would be lost.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
HellWalk, 2020-03-13
@polyanin

If the migrations were done through
php bin/console make:migration
A, by saving data you mean the structure of the tables, and not their contents, then everything is simple:
1. delete all migrations
2. delete all tables from the database (including migrations)
3. run the "php bin/console make" command again :migration"
PS Just in case, make a backup of the database and a git-commit, so that in which case you can roll everything back.
PPS You can also save the data in the database - make the backup of the database a zero point, change it so that only commands for adding data remain in it, and dump the fourth point.

I
Igor, 2020-03-13
@IgorPI

There is such a thing as cumulative migration.
If I am not mistaken, then it is already in the doctrine.
you need to remove all migrations and run a special command to create a cumulative migration file.
And then everything starts again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question