Perform next / previous migration with doctrine migration using symfony 3

I know that I can perform certain migrations using execute with up / down and version number, i.e.

doctrine:migrations:execute YYYYMMDDHHMMSS --down

Then my question is, is there an easier way to just do the next or previous migration without looking at the version numbers?

Ideally, I would like something like

doctrine:migrations:execute --down n

Where n is the number of transitions performed from the current in the specified direction.

(same idea as rake db:rollback STEP=n )

+7
php symfony doctrine2 doctrine-migrations
source share
3 answers

The closest thing to what I was looking for:

doctrine:migrations:migrate prev

doctrine:migrations:migrate next

They cannot be used with n , although if you want to do more than 1 you need to use doctrine:migrations:migrate with the version number you want to switch to.

+4
source share

The DoctrineMigrationsBundle guide covers migration through YYYYMMDDHHMMSS . Because n is not a number, but a date. You can exceed the status and see the latest version you have changed.

 php app/console doctrine:migrations:status --show-versions 
+2
source share

I usually call status , which shows if there are any new ones. If so, I call migrate and it starts all new ones. See Docs here http://docs.doctrine-project.org/projects/doctrine-migrations/en/latest/reference/introduction.html

0
source share

All Articles