Answer the question
In order to leave comments, you need to log in
Migrations can drop the project, what to do?
In my project, I use yii/migrate, once during the deployment I raised the migrations and then it happened. Because of the migrations, the database shut down, after which MySQL fell altogether. The reason was too large table with a large number of records, and in migrations there was ADD COLUMN How to be, how can you make sure in such cases, except for testing?
Answer the question
In order to leave comments, you need to log in
apart from testing
Because of the migrations, the database shut down, after which MySQL fell altogether.This is MySQL, it happens to him.
The reason was too large table with a large number of records, and in migrations there was ADD COLUMN How to be, how can you make sure in such cases, except for testing?I'm not 100% sure (I haven't woken up yet to think too soberly), but it seems to me that there are 2 main options for solving the problem:
The reason was too large table with a large number of recordsIt seems to me that the most likely problem was a too weak machine (memory, processor, disk) for such a volume of database data, and not a too large table :)
You don't need to stop anything.
There is a table T.
The scheme is simple.
1. First, create an empty table T1 with the desired structure. That is, with the column already added.
2. Then we copy the data from T to T1.
3. If the entry in T is very active, then you may have to repeat the copy process for the data that was added while we were copying the original ones.
4. When the copying period becomes small, turn off the data recording in T.
5. Make the final synchronization.
6. Rename T to T_OLD.
A T1 rename to T
7. Enable writing to T
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question