Created
January 2, 2013 16:12
-
-
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…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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