Skip to content

Instantly share code, notes, and snippets.

@achristodoulou
Last active February 23, 2016 18:04
Show Gist options
  • Save achristodoulou/48c5206c59f6c168f427 to your computer and use it in GitHub Desktop.
Save achristodoulou/48c5206c59f6c168f427 to your computer and use it in GitHub Desktop.
When you are writing your first migration many changes are made and this script can drop and recreate the schema
rm -f src/AppBundle/Migrations/*.php &&
php bin/console doctrine:database:drop --force &&
php bin/console doctrine:database:create &&
php bin/console doctrine:migrations:diff &&
php bin/console doctrine:migrations:migrate --no-interaction &&
php bin/console doctrine:fixtures:load --no-interaction
@achristodoulou
Copy link
Author

[Symfony >2.8]

rm -f src/AppBundle/Migrations/*.php &&
php app/console doctrine:database:drop --force &&
php app/console doctrine:database:create &&
php app/console doctrine:migrations:diff &&
php app/console doctrine:migrations:migrate --no-interaction &&
php app/console doctrine:fixtures:load --no-interaction

@achristodoulou
Copy link
Author

Symfony 3 (use existing migrations)

php bin/console doctrine:database:drop --force &&
php bin/console doctrine:database:create &&
php bin/console doctrine:migrations:migrate --no-interaction &&
php bin/console doctrine:fixtures:load --no-interaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment