Skip to content

Commit 1720fa8

Browse files
feat(compare-schema): ci check to make sure schema.ts never goes out of sync with migrations (#2449)
* feat(compare-schema): ci check to make sure schema.ts never goes out of sync with migrations * test out of sync [do not merge] * Revert "test out of sync [do not merge]" This reverts commit 9771f66.
1 parent f3ad775 commit 1720fa8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/test-build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ jobs:
4848
ENCRYPTION_KEY: '7cf672e460e430c1fba707575c2b0e2ad5a99dddf9b7b7e3b5646e630861db1c' # dummy key for CI only
4949
run: bun run test
5050

51+
- name: Check schema and migrations are in sync
52+
working-directory: packages/db
53+
run: |
54+
bunx drizzle-kit generate --config=./drizzle.config.ts
55+
if [ -n "$(git status --porcelain ./migrations)" ]; then
56+
echo "❌ Schema and migrations are out of sync!"
57+
echo "Run 'cd packages/db && bunx drizzle-kit generate' and commit the new migrations."
58+
git status --porcelain ./migrations
59+
git diff ./migrations
60+
exit 1
61+
fi
62+
echo "✅ Schema and migrations are in sync"
63+
5164
- name: Build application
5265
env:
5366
NODE_OPTIONS: '--no-warnings'

0 commit comments

Comments
 (0)