Skip to content

Instantly share code, notes, and snippets.

@woecifaun
Last active August 29, 2015 14:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woecifaun/1861943c3db05a724bc1 to your computer and use it in GitHub Desktop.
Save woecifaun/1861943c3db05a724bc1 to your computer and use it in GitHub Desktop.
Little helper for Symfony doctrine:schema:update
#! /bin/sh
output="$(php app/console doctrine:schema:update --dump-sql)";
echo $output;
case $output in
Nothing* ) return 0;;
esac
printf "\n";
while true; do
read -p "Update database schema for real? (y or n):" yn
case $yn in
[Yy]* ) php app/console doctrine:schema:update --force; break;;
[Nn]* ) return 0;;
* ) echo "Please answer yes [y] or no [n].";;
esac
done
@woecifaun
Copy link
Author

Symfony Doctrine Schema Update Little Helper

A simple shell script to avoid the call of
php app/console doctrine:schema:update --dump-sql
then
php app/console doctrine:schema:update --force

Installation

install this file into your shell PATH scope.

Use

  1. type doctrine_schema_update.
  2. check your schema modifications
  3. type y if you effectively want your schema to be updated
  4. or n otherwise
  5. that's it 😃

tips

  • add alias dsu="doctrine_schema_update" to your shell customization to just launch the script by typing dsu
  • if nothing to update, the script terminates by itself
  • as a new shell script builder, I'm happy to receive any comment to improve these lines

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