#!/bin/sh set -euo pipefail echo "Akkoma Schema Diff" if [ -z $1 ]; then echo "Usage: ./schema-diff " exit 1; fi echo "Using database $1" BRANCH=${2:-stable} echo "Cloning $BRANCH locally..." if [ ! -d src ]; then git clone https://akkoma.dev/AkkomaGang/akkoma/ -b $BRANCH src fi cd src && git checkout $BRANCH && git pull && cd .. ls src/priv/repo/migrations/ | cut -d '_' -f1 | sort -n > expected_migrations.txt psql $1 --csv -t -c "select version from schema_migrations" | sort -n > local_migrations.txt echo "DIFF FOLLOWS" diff expected_migrations.txt local_migrations.txt echo "END DIFF"