Skip to content

Instantly share code, notes, and snippets.

@davidromani
Created September 25, 2016 09:12
Show Gist options
  • Save davidromani/6133b4eb2f80707f233279872a9d2b4d to your computer and use it in GitHub Desktop.
Save davidromani/6133b4eb2f80707f233279872a9d2b4d to your computer and use it in GitHub Desktop.
Symfony DB reset bash script helper
#!/bin/bash
if [ -z "$1" ]
then
php app/console doctrine:database:drop --force
php app/console doctrine:database:create
php app/console doctrine:schema:update --force
# php app/console doctrine:migrations:diff
# php app/console doctrine:migrations:mig
php app/console hautelook_alice:doctrine:fixtures:load -n
else
if [ "$1" = "dev" -o "$1" = "test" -o "$1" = "prod" -o "$1" = "remote" ]
then
if [ "$1" = "remote" ]
then
# cap symfony:doctrine:database:drop
# cap symfony:doctrine:database:create
# cap symfony:doctrine:schema:update
# cap symfony:doctrine:load_fixtures
echo "Be careful, this is a real production environment"
else
php app/console doctrine:database:drop --force --env="$1"
php app/console doctrine:database:create --env="$1"
php app/console doctrine:schema:update --force --env="$1"
php app/console hautelook_alice:doctrine:fixtures:load -n --env="$1"
fi
else
echo "Argument error! Available argument options: 'remote', 'dev', 'test' or 'prod'"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment