Add migration-checks CI workflow#555
Merged
Merged
Conversation
Adds a pull_request-triggered workflow calling migration-checks-npm from shared-workflows (branch-pinned until digicatapult/shared-workflows#111 merges). A separate workflow rather than a job in test.yml because the lint and seeded-upgrade jobs need a pull_request base ref, whereas test.yml runs on push. Migrations live in src/didweb/migrations; Postgres is provided by the existing docker-compose postgres service (did-web-server). ENG-313
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated GitHub Actions workflow to run database migration checks on pull requests by reusing Digital Catapult’s shared migration-checks-npm workflow, configured to validate the did:web Knex migrations. It also bumps the NPM package version to keep repo versioning in sync with existing version automation.
Changes:
- Add PR-triggered
.github/workflows/migration-checks.ymlthat runs migration immutability/order checks plus migrate up/down roundtrips against Postgres. - Point migration checks at
src/didweb/migrations. - Bump package version from
0.20.17→0.20.18inpackage.jsonandpackage-lock.json.
Executive summary (≤10 lines)
- Adds CI coverage for “bad” Knex migrations (immutability, ordering, and roundtrip apply/rollback/apply).
- Uses shared workflow defaults for Postgres via
docker-compose.ymlservicepostgres, matching local runtime config. - Risk is low (CI-only, read-only permissions in the new workflow).
- Merge recommendation: approve.
Blockers (Must-Fix)
- None identified.
Targeted suggestions
- None.
Test gap analysis
- No new runtime logic introduced; workflow-only change. No additional unit/integration tests expected beyond the new CI job itself.
Integration risks
- CI now requires the runner to successfully start the
postgresservice fromdocker-compose.ymland have port5432available for the job’s migration steps. - The reusable workflow runs
npm ciandnpm run db:migrate/npm run db:rollback; this repo’s defaults inknexfile.jsalign with that (hostlocalhost, DBdid-web-server, user/passwordpostgres).
Scores (rubric)
| Category | Score (/10) | Reason |
|---|---|---|
| Correctness | 9 | Workflow inputs/defaults align with repo’s knexfile.js and migration directory. |
| Security | 8 | CI-only, minimal permissions (contents: read) on the new workflow; reuse of shared workflow is consistent with existing CI patterns. |
| Testing | 8 | Adds preventative CI coverage for migration correctness; no app code changes requiring tests. |
| Maintainability | 9 | Keeps migration checks isolated from test.yml while reusing a shared workflow. |
| Performance | 10 | No runtime performance impact (CI-only). |
| Integration/Infra | 8 | Adds a new PR workflow that depends on docker compose bringing up Postgres reliably. |
| Overall | 9 | Low-risk CI enhancement aligned with existing workflow reuse patterns. |
Release notes draft
- Add PR CI workflow to validate Knex migrations (immutability, ordering, and migrate/rollback roundtrip).
- Configure migration checks to run against did:web migrations under
src/didweb/migrations. - Bump package version to
0.20.18.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
package.json |
Bumps package version to 0.20.18. |
package-lock.json |
Keeps lockfile version in sync with package.json (0.20.18). |
.github/workflows/migration-checks.yml |
Adds PR-triggered reusable workflow invocation for Knex migration checks targeting src/didweb/migrations. |
Bringing up just the postgres service from the full testnet docker-compose still validates the whole file, which fails on cert bind mounts that setup:certs normally provisions. Use the image fallback pinned to the same postgres image the compose file uses. ENG-313
Resolves package.json/package-lock.json conflicts from #554 by taking main; the version-sync bot re-bumps on the next synchronize. Fixes the merge conflict that was suppressing pull_request CI runs. ENG-313
Runs the migration-checks shared workflow on push to main and gates the docker build/release on it, so a migration that only fails against existing data blocks the release rather than surfacing at deploy time. Branch-pinned until digicatapult/shared-workflows#111 merges. ENG-313
ehaldane-digicatapult
previously approved these changes
Jul 13, 2026
Resolves package.json/package-lock.json version conflict with main. ENG-313
ehaldane-digicatapult
previously approved these changes
Jul 13, 2026
ehaldane-digicatapult
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Checklist
PR Type
Linked tickets
ENG-313
High level description
Adopts the new
migration-checks-npmshared workflow to catch bad knex migrations in CI.Detailed description
Adds a
pull_request-triggeredmigration-checks.ymlthat callsdigicatapult/shared-workflows/.github/workflows/migration-checks-npm.yml, pointed atsrc/didweb/migrations. Postgres is provided by the existingdocker-compose.ymlpostgresservice (did-web-server), so the CI database version matches what the agent runs.A dedicated workflow is used rather than a job in
test.ymlbecause the lint and seeded-upgrade jobs compare against thepull_requestbase ref, whereastest.ymlhere runs onpush.Branch pin: the
uses:reference points at@ENG-313-migration-checksuntil shared-workflows#111 merges, then flips to@main.Follow-up: there is no seed script in this repo today, so the seeded-upgrade job runs against an empty database for now. Adding didweb smoke seeds is tracked as follow-up in ENG-313's out-of-scope list.
Describe alternatives you've considered
Adding the job to the existing
push-triggeredtest.yml— rejected because the lint and seeded-upgrade jobs would self-skip without a PR base ref.Operational impact
CI-only. New
pull_requestjob that brings up the existingpostgrescompose service. No runtime change.Additional context
Part of the ENG-313 rollout alongside testbed-portal, spec-rag-api, and the hello-world canary.