DEV Community

Mati Andreas
Mati Andreas

Posted on

Testing doctrine migration in Symfony project

  1. Checkout to the master branch
    git checkout master.

  2. Update database to match current doctrine schema, also removing excess tables
    php bin/console d:s:u --force --complete, where d:s:u is automatic short version of doctrine:schema:update, provided by Symfony console.

    NB! It deletes all tables from the database that are not in doctrine schema!
    If you want to keep some tables (migration table could also be removed), then run php bin/console d:s:u --dump-sql --complete
    do display excess tables, remove them manually and then run php bin/console d:s:u --force to make schema up-to-date with master.

  3. Add all migrationsphp bin/console d:m:v --all --add -n
    where d:m:v is automatic short version of doctrine:migrations:version, provided by Symfony console.

  4. Checkout to your feature branch git checkout KEY-123

  5. Run migrations php bin/console d:m:m -n, where d:m:m is automatic short version of doctrine:migrations:migrate, provided by Symfony console.

Top comments (0)