fix(cms): move enum types from public to payload schema#416
Conversation
|
|
|
View your CI Pipeline Execution ↗ for commit 97ca8e4
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Pull request overview
This PR standardizes enum placement for the CMS database by ensuring enums live under the payload schema (instead of lingering in public from older migrations), and adds a test-migration workflow to validate migrations against production backups in an isolated Docker Postgres instance.
Changes:
- Add migration
20260411_000000_enum_schema_cleanupplus a verify hook to ensurepubliccontains no enum types after migrating. - Add a new
test-migrationdb-tool (wired intopnpm cdwr) that restores a production backup into Docker, runs pending migrations, and runs migration-specific verify hooks. - Configure Payload’s Postgres adapter with an explicit
migrationDirto avoid cwd-dependent migration resolution.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/db-tools/project.json | Adds an Nx target to run the new test-migration tool. |
| tools/db-tools/lib/verify-types.ts | Introduces a shared contract for migration verify hooks. |
| tools/db-tools/lib/test-migration.ts | Implements end-to-end migration testing against restored production backups in Docker. |
| tools/cdwr-cli.ts | Exposes test-migration through the cdwr tool menu. |
| apps/cms/src/utils/run-migrations.ts | Adds a minimal non-interactive runner used by the migration test tool. |
| apps/cms/src/payload.config.ts | Sets migrationDir so Payload finds migrations reliably. |
| apps/cms/src/migrations/verify/20260411_000000_enum_schema_cleanup.ts | Adds migration-specific assertions for enum schema placement. |
| apps/cms/src/migrations/index.ts | Registers the new migration. |
| apps/cms/src/migrations/20260411_000000_enum_schema_cleanup.ts | Moves/casts enum usage to payload-qualified types and drops public copies. |
| apps/cms/.env.local | Adds commented env hints for connecting to the kept-alive Docker DB. |
| .mcp.json | Adds Sentry MCP server configuration. |
| .claude/settings.json | Enables the Sentry MCP server in Claude settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✨ Your pull request projects are ready for preview
|
05e859e to
62bf5cf
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #416 +/- ##
=========================================
+ Coverage 0 42.16% +42.16%
=========================================
Files 0 120 +120
Lines 0 1480 +1480
Branches 0 315 +315
=========================================
+ Hits 0 624 +624
- Misses 0 822 +822
- Partials 0 34 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
20260411_000000_enum_schema_cleanupthat moves all enum types from thepublicschema into thepayloadschema — fixing a long-standing inconsistency where early migrations created enums without an explicit schema prefixtest-migrationdb-tool that backs up production, restores into an isolated Docker Postgres container, runs pending migrations, verifies the result, and optionally keeps the container running for local developmentapps/cms/src/migrations/verify/{migrationName}.ts) for migration-specific assertionsmigrationDirto the Postgres adapter config so Payload resolves migrations correctly regardless ofprocess.cwd().mcp.json+.claude/settings.json)Test plan
pnpm cdwr→test-migrationpublic, 15 enum types inpayload