0

Is it possible to migrate up a specific migration in Yii 1.1 ?

I have created some migrations but i want to execute a specific migration before all other migrations are up.

Also, yiic migrate up 3 will migrate the latest three migrations and at the same time when i used yiic migrate up 1 , it doesn't asking for the intended migration.

I have tried yiic migrate up m151125_053608 but it is not working.

How to achieve such scenario? Thanks

Owais
  • 49
  • 12

2 Answers2

0

If you already create three migrations and want to add new one to be first. Then just create file name matching that RegExp /^(m(\d{6}_\d{6})_.*?)\.php$/.

Something like this: m150101_000000_100.php

But all next migrations shoudn't be applied yet.

SiZE
  • 2,217
  • 1
  • 13
  • 24
0

I suggest two ways to make this:

  1. Run the command:
yiic migrate to 151125_053608 # In this case
  1. By modifing the migration info (if the migration to apply is the last)

Important: copy the timestamp to restaurate the migration info later.

yiic migrate mark ######_###### Timestamp of the penultimate migration

After this do

yii migrate

Apply migration and restore the migration information with the timestamp copied.

Ref: https://www.yiiframework.com/doc/guide/1.1/en/database.migration

Alberto Manuel
  • 163
  • 1
  • 5