Add schema diff
This commit is contained in:
commit
fa4cee9bbe
|
@ -0,0 +1,2 @@
|
|||
*.txt
|
||||
src
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
|
||||
echo "Akkoma Schema Diff"
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Usage: ./schema-diff <DB_NAME> <BRANCH:stable>"
|
||||
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"
|
Loading…
Reference in New Issue