mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
28 lines
620 B
Bash
Executable File
28 lines
620 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
OUTPUT=$(echo "\dt" | psql `echo $DATABASE_URL | cut -d? -f1` 2>&1)
|
|
|
|
if [[ "$OUTPUT" = "No relations found." ]]; then
|
|
echo "Initialising database"
|
|
DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bundle exec rake db:structure:load
|
|
else
|
|
echo "Executing database migrations..."
|
|
bundle exec rake db:migrate
|
|
fi
|
|
|
|
echo "Executing database seed..."
|
|
bundle exec rake db:seed
|
|
SEED_STATUS=$?
|
|
if [ $SEED_STATUS -ne 0 ]; then
|
|
echo "Database seed failed with status $SEED_STATUS"
|
|
exit $SEED_STATUS
|
|
fi
|
|
|
|
if [ "$1" = "--set" ]; then
|
|
shift
|
|
echo "Update application settings..."
|
|
bundle exec rake setting:set["$@"]
|
|
fi
|
|
|
|
exit 0
|