diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index b03e64d..027aa4f 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -18,3 +18,7 @@ jobs: docker run --rm --network host -e DATABASE_USER=vdbm -e DATABASE_PASSWORD=password \ -e DATABASE_HOSTNAME=127.0.0.1 -e DATABASE_PORT=5432 -e DATABASE_NAME=vulcanize_public \ vulcanize/statediff-migrations + - name: Verify schema is latest + run: | + PGPASSWORD="password" pg_dump -h localhost -p 5432 -U vdbm vulcanize_public --no-owner --schema-only > schema.sql + ./scripts/check_diff.sh diff --git a/db/schema.sql b/db/schema.sql index 4f254fd..aaf4c5a 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -3,7 +3,7 @@ -- -- Dumped from database version 10.12 --- Dumped by pg_dump version 13.3 +-- Dumped by pg_dump version 13.4 (Ubuntu 13.4-1.pgdg20.04+1) SET statement_timeout = 0; SET lock_timeout = 0; diff --git a/scripts/check_diff.sh b/scripts/check_diff.sh new file mode 100755 index 0000000..3286ca3 --- /dev/null +++ b/scripts/check_diff.sh @@ -0,0 +1,7 @@ +lines=$( git diff --no-index db/schema.sql schema.sql | wc -l ) +if [ $lines -gt 0 ]; then + echo "There are differences in schema" + git diff --no-index db/schema.sql schema.sql + exit 1 +fi +echo "Schema is latest" \ No newline at end of file