Search code examples
phpsymfonydoctrine-ormsymfony-3.3doctrine-migrations

Execute next / previous migration with doctrine migrations using symfony 3


I know that I can run specific migrations using execute with up / down and version number, ie

doctrine:migrations:execute YYYYMMDDHHMMSS --down

My question then - is there an easier way to simply run the next or previous migration without having to look up version numbers?

Ideally I would like something like

doctrine:migrations:execute --down n

Where n is the number of migrations to run from current in the specified direction.

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


Solution

  • Closest thing to what I was looking for is:

    doctrine:migrations:migrate prev

    doctrine:migrations:migrate next

    These cannot be used in conjunction with n though, so if you want to do more than 1 you need to use doctrine:migrations:migrate with the version number you want to go to.