forked from dockers/pixelfed
run migrations when needed
This commit is contained in:
parent
e82d0a1ae6
commit
724d8d3435
2 changed files with 18 additions and 1 deletions
|
@ -5,7 +5,7 @@ cp -r storage.skel/* storage/
|
||||||
|
|
||||||
php /wait-for-db.php
|
php /wait-for-db.php
|
||||||
|
|
||||||
if [[ ! -e storage/.docker.init ]];
|
if [[ ! -e storage/.docker.init ]]
|
||||||
then
|
then
|
||||||
echo "Fresh installation, initializing database..."
|
echo "Fresh installation, initializing database..."
|
||||||
php artisan key:generate
|
php artisan key:generate
|
||||||
|
@ -21,5 +21,14 @@ php artisan route:cache
|
||||||
php artisan view:cache
|
php artisan view:cache
|
||||||
php artisan config:cache
|
php artisan config:cache
|
||||||
|
|
||||||
|
echo "++++ Check for needed migrations... ++++"
|
||||||
|
# check for migrations
|
||||||
|
php artisan migrate:status | grep No && migrations=yes || migrations=no
|
||||||
|
if [ $migrations = "yes" ];
|
||||||
|
then
|
||||||
|
php artisan migrate --force
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "++++ Start apache... ++++"
|
||||||
source /etc/apache2/envvars
|
source /etc/apache2/envvars
|
||||||
/usr/local/sbin/dumb-init apache2 -DFOREGROUND
|
/usr/local/sbin/dumb-init apache2 -DFOREGROUND
|
||||||
|
|
|
@ -10,4 +10,12 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
gosu www-data php artisan migrate:status | grep No && migrations=yes || migrations=no
|
||||||
|
if [ $migrations = "yes" ];
|
||||||
|
then
|
||||||
|
echo "Database needs migrations, exiting..."
|
||||||
|
sleep 5
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
gosu www-data php artisan horizon
|
gosu www-data php artisan horizon
|
||||||
|
|
Loading…
Reference in a new issue