Merge pull request #778 from letsencrypt/goose-up

Add goose-up script to easily do migrations.
This commit is contained in:
Roland Bracewell Shoemaker 2015-09-17 16:32:11 -07:00
commit ac095b0467
3 changed files with 38 additions and 14 deletions

View File

@ -1,18 +1,6 @@
#!/bin/bash
function die() {
if [ ! -z "$1" ]; then
echo $1 > /dev/stderr
fi
exit 1
}
SERVICES="ca
sa
policy"
DBENVS="development
test
integration"
cd $(dirname $0)/..
source test/db-common.sh
for svc in $SERVICES; do
for dbenv in $DBENVS; do

17
test/db-common.sh Normal file
View File

@ -0,0 +1,17 @@
# Common variables used by Goose-related scripts.
set -o errexit
set -o xtrace
function die() {
if [ ! -z "$1" ]; then
echo $1 > /dev/stderr
fi
exit 1
}
SERVICES="ca
sa
policy"
DBENVS="development
test
integration"

19
test/migrate-up.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
#
# Run this script after pulling changes that have migrations, to migrate your
# local DB.
#
cd $(dirname $0)/..
source test/db-common.sh
for svc in $SERVICES; do
for dbenv in $DBENVS; do
db="boulder_${svc}_${dbenv}"
goose -path=./$svc/_db/ -env=$dbenv up || die "unable to migrate ${db}"
echo "migrated ${db} database"
done
done
echo "migrated all databases"