db/scripts/diff.sh
Orion Kindel 5da43ddf0f
All checks were successful
migrate / migrate devel (push) Successful in 1m14s
chore: add ci for migrating against devel
2023-06-18 11:25:57 -05:00

24 lines
530 B
Bash
Executable File

#! /bin/bash
set -e
source ./scripts/env.sh ./.env.schema
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
migra --unsafe $base_url $head_url || echo "migra exited with code $?. this is /probably/ fine" 1>&2