6

How can I delete the old migrations differences? When doing doctrine:generate-migrations-diff I get no problems, but when doing the doctrine:migrate I get problems. It seems as if doctrine is trying to migrate old stuff that doesnt "count" any longer ...

Thanks

3 Answers 3

8

Just to complement the selected answer (from the documentation):

Adding a version:

./doctrine migrations:version YYYYMMDDHHMMSS --add

Deleting a version:

./doctrine migrations:version YYYYMMDDHHMMSS --delete

The command does not execute any migrations code, it simply adds the specified version to the database.

More info

4

Either delete the migration class or add the generate version table (can't remember the exact name) and set the value to the migration you want start from.

4
  • Where do I find this class or table?
    – user89862
    Commented Feb 3, 2011 at 10:57
  • 1
    Once you've run a migration, there will be a new table in that database. I think it called migration_version. It should have one column with one row. If you just change the value of the row to the migration before the one you want to run.
    – xzyfer
    Commented Feb 3, 2011 at 10:59
  • When you generate doctrine migrations it creates class files that extend Doctrine_Migration. If you just delete the migrations you don't want to run, then the won't run when you call doctrine:migrate. If you're using symfony, those migration class are in lib/migration.
    – xzyfer
    Commented Feb 3, 2011 at 11:01
  • I just deleted all the php files I could find inside migration/doctrine. Worked like a dream :)
    – user89862
    Commented Feb 3, 2011 at 11:07
1

In Symfony 5, the migrations are in the src/Migrations folder.

I found that locally I had deleted the bad migration, but on production the old Migrations files where still there even after a git push.

I also cleared the table (or migration) in the database in the table migration_version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.