db/scripts/diff.sh

24 lines
454 B
Bash
Raw Normal View History

2023-06-09 01:29:13 +00:00
#! /usr/bin/bash
set -e
source ./scripts/env.sh
rev=${1:-}
head_url=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5432/$POSTGRES_DB
base_url=postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost:5433/$POSTGRES_DB
if [[ -z "$rev" ]]; then
echo "revision to diff is required";
exit 1;
fi
docker compose up -d
./scripts/build.sh $rev
./scripts/build.sh HEAD
echo "migrate from $rev => HEAD" 1>&2
2023-06-09 01:49:47 +00:00
migra --unsafe $base_url $head_url