'Mark an individual Doctrine migration as ran/executed

Is there a way that I can mark a Doctrine migration as "ran" or "executed" in the way that it won't be shown as a migration that needs to be migrated?

app/console doctrine:migrations:migrate --add Version20140409203042

I don't see anything in the --help.

The reason for doing this is my DB is up to date and imported from elsewhere, but this migration is asking to be ran every time I run a doctrine:migrations:migrate.



Solution 1:[1]

I found that this functionality falls under the version command:

Use this command to add a single version:

app/console doctrine:migrations:version 20140430223207 --add

Use this command to add them all:

app/console doctrine:migrations:version --add --all

Solution 2:[2]

In your database is table where stored doctrine migrations. You can just add line with version id (20140409203042). Default name of this table is migration_versions, i think, or you can find name in config (http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html)

It is one possible solutions for doing migrations wihout running it. But you really should control all queries, if it ok. If one, or more are missing, you should do migrations with queries commented out.

Solution 3:[3]

In newer versions of doctrine the migration version name contains a namespace (Skipping Migrations)

Now the command may look like this:

bin/console doctrine:migrations:version 'DoctrineMigrations\Version20220407777666' --add

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 colonelclick
Solution 2 omelkes
Solution 3 Artem Shevtsov