Skip to content

Instantly share code, notes, and snippets.

@Dynom
Created January 2, 2013 16:12
Show Gist options
  • Save Dynom/4435697 to your computer and use it in GitHub Desktop.
Save Dynom/4435697 to your computer and use it in GitHub Desktop.
This current Doctrine2 migrations shell wrapper fails, with the following message: "The specified connection file is a valid file", when run like this: ./bin/runMigrations.sh migrations:status The message is a typo, the actual message is about the connection file being NOT valid. When I paste the result (from the debug feedback, at the bottom of…
#!/usr/bin/env bash
# The arguments
ARGS="$@";
PHP_EXEC="$( which php )"
# TRYING to obtain the path we're located in.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
EXECUTABLE="$DIR/../tools/migrations/doctrine-migrations.phar"
# The configuration arguments
CONFIG_ARGS="--db-configuration=\"$DIR/../tools/migrations/connectionSettings.php\" --configuration=\"$DIR/../tools/migrations/configuration.yml\""
# Handling configuration arguments for the migrations argument, only works when
# the command starts with "migrations:" improve when needed.
if [ "${ARGS:0:11}" == "migrations:" ];
then
ARGS="$ARGS $CONFIG_ARGS";
fi
# Executing doctrine migrations with the config files and the original arguments
$PHP_EXEC $EXECUTABLE $ARGS;
if [ $? -ne 0 ];
then
echo 'Doctrine migrations did not run as expected. Migration commands are prefixed with "migrations:"'.
echo -e "The executed command is:\n\t'$PHP_EXEC $EXECUTABLE $ARGS'"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment