Closed karolls closed 3 years ago
Hm, I totally forgot about that feature of Yii, thank you for reminding me. Yes, this needs to be redone. I would rather automatically set timer "in the past" for the ones within the same second.
I would rather automatically set timer "in the past" for the ones within the same second.
Yes but can be tricky as you can collide with some migration in the past. Let's say you have migration in the past that create a table and now you are generating migrations that one of the new ones update this table. Update migration time can't be set before the create migration. Not highly probable in real life, but still.
You are again right. Need to think of something clever.
Is your feature request related to a problem? Please describe.
Yii2 uses a migration file timestamp to differentiate migrations. Probably this is more Yii2 related issue however since noone knows if and how it's going to be resolved, would be nice to implement a solution in yii2-migration.
When running a command for all or multiple tables:
php yii migration/create "*"
it is almost certain that the generated migrations will look like (with the same timestamp):
Now let's say you will run:
php yii migrate/mark m210820_055600_010_create_table_X
or
yii migrate/mark "2021-08-20 05:56:00"
Since Yii2 operates on timestamps it will loop through migrations comparing only timestamp (210820_055600) and breake the process after marking the first migration which timestamp matches. So in example above only migration m210820_055600_001_create_table_A will be marked as done and placed in migration table and none after it. This is not right.
There is the same problem with running yii migration related commands:
and
Describe the solution you'd like
Would be nice as a feature to add a parameter for migration/create and migration/update to add a delay between generating each migration files not to collide with same timestamp:
Describe alternatives you've considered
Any other solution making it possible to generate multiple migration files with different timestamps.