Skip to content

Commit

Permalink
Merge pull request #11 from vulcanize/latest-schema
Browse files Browse the repository at this point in the history
Check schema is latest version.
  • Loading branch information
arijitAD authored Sep 20, 2021
2 parents ef92cb4 + 4bb9f60 commit 5e69d01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions scripts/check_diff.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 5e69d01

Please sign in to comment.