feat(db): add APP_ENV in doctrine-migrate script

This commit is contained in:
Simon Vieille 2023-01-08 21:47:59 +01:00
parent fdc6c423ff
commit d4eabf1937
Signed by: deblan
GPG key ID: 579388D585F70417

View file

@ -1,7 +1,9 @@
#!/bin/sh
CLASS_NAME="$(echo "yes" | "$PHP" ./bin/console doctrine:migration:diff -e dev | grep -o "Version[0-9]*" | tail -n 1)"
APP_ENV="${APP_ENV:-dev}"
CLASS_NAME="$(echo "yes" | "$PHP" ./bin/console doctrine:migration:diff -e "$APP_ENV" | grep -o "Version[0-9]*" | tail -n 1)"
if [ -n "$CLASS_NAME" ]; then
echo "yes" | "$PHP" ./bin/console doctrine:migration:exec --up "DoctrineMigrations\\$CLASS_NAME" -e dev
echo "yes" | "$PHP" ./bin/console doctrine:migration:exec --up "DoctrineMigrations\\$CLASS_NAME" -e "$APP_ENV"
fi