From 26e4bd3fe2a03948f0a80d6144cba7078c229bad Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Fri, 12 Jun 2026 12:08:00 +0300 Subject: [PATCH] ci: Fold DB schema docs check into the DB Tests job (no-changelog) (#32200) --- .../plugins/n8n/skills/db-migrations/SKILL.md | 6 +++--- .github/workflows/ci-pull-requests.yml | 21 ------------------- .github/workflows/test-db-reusable.yml | 8 +++++++ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/.claude/plugins/n8n/skills/db-migrations/SKILL.md b/.claude/plugins/n8n/skills/db-migrations/SKILL.md index dac121ff9ad..f177c58252c 100644 --- a/.claude/plugins/n8n/skills/db-migrations/SKILL.md +++ b/.claude/plugins/n8n/skills/db-migrations/SKILL.md @@ -123,7 +123,7 @@ Run through this before requesting review. Each item is a real, recurring review - [ ] **One logical change per migration**; split unrelated table changes into separate files. — [Don't combine independent schema changes](#dont-combine-independent-schema-changes) - [ ] **`up()` / `down()` reads as a list of intentions.** If either body grows past a screen or mixes schema operations with a multi-statement raw-SQL data move, extract the data move into a `private async` method on the same class (e.g. `private async backfillFromX(ctx)`). The top-level should orchestrate, not implement. - [ ] **Precedent is the bar to fix, not perpetuate.** When the checklist conflicts with what an older migration does (e.g. redundant `.primary.notNull`, hand-quoted identifiers, missing `.comment()`), the checklist wins for new code — don't copy the violation forward. Note the old occurrences in the PR if you spotted them. -- [ ] **Regenerated the schema docs** with `pnpm db:schema:docs` and committed the `docs/generated/` changes. The `schema-docs-check` CI job fails on stale docs. — [Schema documentation](#schema-documentation) +- [ ] **Regenerated the schema docs** with `pnpm db:schema:docs` and committed the `docs/generated/` changes. The DB Tests CI job fails on stale docs. — [Schema documentation](#schema-documentation) Treat the checklist as a floor, not a ceiling. If any item fails, fix it before opening review. @@ -791,7 +791,7 @@ Regenerate and commit them alongside your migration: ```sh pnpm db:schema:docs # rewrites docs/generated/ — requires Docker (and `brew install tbls` locally) -pnpm db:schema:check # verify only; what the schema-docs-check CI job runs +pnpm db:schema:check # verify only; what the DB Tests CI job runs ``` -The `schema-docs-check` CI job fails the PR when the committed docs don't match the migrations. Don't hand-edit anything under `docs/generated/` — it's overwritten on every regeneration. +The DB Tests CI job fails the PR when the committed docs don't match the migrations (each matrix leg verifies its own database). Don't hand-edit anything under `docs/generated/` — it's overwritten on every regeneration. diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index a2c1c96085b..905f5479979 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -307,26 +307,6 @@ jobs: with: ref: ${{ needs.install-and-build.outputs.commit_sha }} - schema-docs-check: - name: DB Schema Docs Check - if: needs.install-and-build.outputs.db == 'true' - runs-on: ${{ vars.RUNNER_PROVIDER == 'github' && 'ubuntu-latest' || 'blacksmith-4vcpu-ubuntu-2204' }} - needs: install-and-build - steps: - - uses: useblacksmith/checkout@41cdeedae8edb2e684ba22896a5fd2a3cb85db6b # v1 - with: - ref: ${{ needs.install-and-build.outputs.commit_sha }} - - - name: Setup Node.js - uses: ./.github/actions/setup-nodejs - with: - build-command: pnpm turbo run build --filter=@n8n/db - - # Regenerates the schema docs (sqlite + postgres-in-a-container) and fails - # if they differ from what's committed. tbls runs as a Docker image in CI. - - name: Verify schema docs are up to date - run: pnpm --filter=@n8n/db schema:check - performance: name: Performance needs: install-and-build @@ -401,7 +381,6 @@ jobs: e2e, dev-server-smoke, db-tests, - schema-docs-check, performance, security-checks, workflow-scripts, diff --git a/.github/workflows/test-db-reusable.yml b/.github/workflows/test-db-reusable.yml index 44dfeb333c0..86987fa7b51 100644 --- a/.github/workflows/test-db-reusable.yml +++ b/.github/workflows/test-db-reusable.yml @@ -24,6 +24,7 @@ jobs: runner: blacksmith-4vcpu-ubuntu-2204 test-cmd: pnpm test:sqlite migration-cmd: pnpm test:sqlite:migrations + schema-check-cmd: pnpm --filter=@n8n/db schema:check:sqlite collectCoverage: 'false' - name: Postgres 16 # 4vcpu is enough since persistent-worker + template-DB make PG16 @@ -33,6 +34,7 @@ jobs: runner: blacksmith-4vcpu-ubuntu-2204 test-cmd: pnpm test:postgres:integration:tc migration-cmd: pnpm test:postgres:migrations:tc + schema-check-cmd: pnpm --filter=@n8n/db schema:check:postgres TEST_IMAGE_POSTGRES: 'postgres:16' collectCoverage: 'true' env: @@ -58,6 +60,12 @@ jobs: working-directory: packages/cli run: ${{ matrix.migration-cmd }} + # Regenerates the schema docs for this leg's database (sqlite temp file / + # postgres testcontainer) and fails if they differ from what's committed. + # tbls runs as a Docker image in CI. + - name: Verify schema docs are up to date + run: ${{ matrix.schema-check-cmd }} + - name: Upload coverage to Codecov if: env.COVERAGE_ENABLED == 'true' uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2