Repository navigation
fix: localizeStatus PG migration db.execute signature - #16889
Conversation
All db.execute calls used the wrong signature:
db.execute({ drizzle: db.drizzle, sql: sql`...` })
The db parameter in MigrateUpArgs IS the raw Drizzle PostgresDB instance.
It has no .drizzle sub-property. The correct call is:
db.execute(sql`...`)
Also fixes inserted.length -> inserted.rows.length in up.ts.
Co-authored-by: Copilot <[email protected]>
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Migration execution and test calls packages/payload/src/versions/migrations/localizeStatus/sql/up.ts, packages/payload/src/versions/migrations/localizeStatus/sql/migrateMainCollection.ts, packages/payload/src/versions/migrations/localizeStatus/sql/migrateMainGlobal.ts, packages/payload/src/versions/migrations/localizeStatus/sql/down.ts, test/localization/localizeStatus.int.spec.ts |
The forward and rollback migrations pass SQL templates directly to db.execute. Integration test calls pass db.drizzle or payload.db.drizzle. Insert logging reads the inserted-row count from inserted.rows.length. |
Workflow runner updates
| Layer / File(s) | Summary |
|---|---|
Playwright runner compatibility .github/workflows/main.yml |
The tests-e2e and build-and-test-templates jobs use Ubuntu 24.04 instead of Ubuntu 26.04. Each job includes a comment that Playwright 1.58 does not support Ubuntu 26.04. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- payloadcms/payload#19015: Changes runner labels for related E2E and template jobs in the 3.x workflow; its Playwright version is not shown in the supplied context.
Suggested reviewers: alessiogr
Merge Risk: 
Minimal · up to 49494
-
No concrete merge-blocking issue is evident in the reviewed changes.
Architecture risk: 
Low · up to 49494
-
The change affects 2 systems.
Changed systems:
packages/payload,testArchitecture concerns
No architecture-level concerns identified.Review details
-
Systems and components
- observed — packages/payload (library) was modified; 4 changed files map to changed impact.
- observed — test (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in packages/payload/src/versions/migrations/localizeStatus/sql/down.ts: Rollback queries now pass SQL directly to
db.execute; the prior{ drizzle: db.drizzle, sql }wrapper was removed. The SQL statements and conditional behavior for restoring and dropping localized status columns remain unchanged. - observed — Modified behavior in packages/payload/src/versions/migrations/localizeStatus/sql/down.ts: The fallback path now passes SQL directly to
db.executewhen restoring_status, selecting documents and latest version statuses, and updating each document. The prior wrapper object was removed; query logic and the'draft'fallback remain unchanged. - observed — Modified behavior in packages/payload/src/versions/migrations/localizeStatus/sql/migrateMainCollection.ts: The document-selection query now passes its SQL template directly to
db.execute, removing the{ drizzle: db.drizzle, sql }wrapper. - observed — Modified behavior in packages/payload/src/versions/migrations/localizeStatus/sql/migrateMainCollection.ts: The latest-version-status query now passes its SQL template directly to
db.execute, removing the{ drizzle: db.drizzle, sql }wrapper. The query still selects the newest matching version status for the document and locale.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Description check
-
Explanation
The pull request description directly explains the PostgreSQL migration fixes, the corrected db.execute signature, and the inserted.rows.length correction. These changes match the files and objectives.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
This reverts commit 4949436.
|
🚀 This is included in version v3.92.1 |
Requires #19071 for clean-cache browser setup on the
3.xCI runners.What
Fixes the broken
localizeStatusmigration for PostgreSQL databases.Why
All
db.executecalls in the 4 SQL migration files used the wrong signature:The
dbparameter passed into migration functions IS the raw DrizzlePostgresDBinstance — it has no.drizzlesub-property. The correct call pattern (used throughout the rest of the drizzle codebase) is:Also fixes
inserted.length→inserted.rows.lengthinup.ts(the result object has a.rowsarray, not a top-level length).Files changed
sql/up.tssql/down.tssql/migrateMainCollection.tssql/migrateMainGlobal.tsThese are pure bug fixes with no behaviour changes — the migration logic is identical, only the call signature is corrected.
Created from comments on this PR #14667