Skip to content

Instantly share code, notes, and snippets.

@andybeak
Created May 13, 2020 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andybeak/df4dc43e3484d8afc8177a266b003641 to your computer and use it in GitHub Desktop.
Save andybeak/df4dc43e3484d8afc8177a266b003641 to your computer and use it in GitHub Desktop.
Symfony recreate database
#!/bin/bash
echo "-----------------------------------------------------------------------------------------------"
echo " 💣This command will move your Migration PHP files to /tmp, drop the database, and recreate it"
echo "-----------------------------------------------------------------------------------------------"
read -r -p "Are you sure you want to do this? [y/N] " response
echo ""
if [[ "$response" =~ ^[Yy]$ ]]
then
mv ../src/Migrations/*.php /tmp
../bin/console doctrine:database:drop --force
../bin/console doctrine:database:create
../bin/console d:m:diff --formatted
../bin/console doctrine:migrations:migrate --no-interaction
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment