From 1720fa874928276658db6dbefca17f798663490c Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Thu, 18 Dec 2025 11:25:19 -0800 Subject: [PATCH] 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 9771f66b8467371815387655f2741bd222aaf921. --- .github/workflows/test-build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 82578194a..90e0ef524 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -48,6 +48,19 @@ jobs: ENCRYPTION_KEY: '7cf672e460e430c1fba707575c2b0e2ad5a99dddf9b7b7e3b5646e630861db1c' # dummy key for CI only run: bun run test + - name: Check schema and migrations are in sync + working-directory: packages/db + run: | + bunx drizzle-kit generate --config=./drizzle.config.ts + if [ -n "$(git status --porcelain ./migrations)" ]; then + echo "❌ Schema and migrations are out of sync!" + echo "Run 'cd packages/db && bunx drizzle-kit generate' and commit the new migrations." + git status --porcelain ./migrations + git diff ./migrations + exit 1 + fi + echo "✅ Schema and migrations are in sync" + - name: Build application env: NODE_OPTIONS: '--no-warnings'