DEV Community

Mati Andreas
Mati Andreas

Posted on

3 1

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.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more