J
J
John-Galt2017-10-28 21:11:49
HTML
John-Galt, 2017-10-28 21:11:49

Transactions do not work with migrations in Yii2. ??

Please tell me what could be wrong.
I am doing migrations in Yii2 using the safeUp and safeDown methods. Base - MySQL.
And in one migration, several labels are created. If an error occurs while creating one of the labels, then all the labels that were created earlier in this migration will be created. As far as I understand, the safeUp and safeDown methods should use a transaction, but it turns out that it does not work.
What could be wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
VicTHOR, 2019-08-01
@shitprog

This is both the code and the link, click and you will see a performance test. The whole point of the s modifier is to recognize all text as 1 line. In order not to escape the slash, I used delimiters ~ If something doesn't work out, write a language and a function.

B
Boris Korobkov, 2017-10-28
@BorisKorobkov

DDL (create, alter, drop) cannot be rolled back. This is not Yii or even PHP, but MySQL.

N
Nikolay ResviL, 2019-06-17
@MLDevelop

in short, within a transaction, you can manipulate the data stored in the database, but not with the structure of the database itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question