fix(ci): repair qty-precision migration trigger dependency + regenerate stale workflow docs#333
Conversation
…te stale workflow docs Two pre-existing CI blockers (red on every PR; not introduced by recent work): 1. Migration 20260619120000_cost_layer_qty_precision_14_6 alters stock_movements.qty to numeric(14,6), but the stock_movements_reporting_evidence_guard constraint trigger (20260602103000) lists qty in its 'UPDATE OF ... qty ...' column set, so Postgres refuses: 'cannot alter type of a column used in a trigger definition' (P3018). prisma migrate deploy failed on a fresh DB, blocking the e2e-select, invariant-preflight, and schema-guardrails(fresh-db-drift) jobs entirely. Drop the trigger around the column rewrite and recreate it identically (the trigger function is unchanged). Only stock_movements.qty had a column-scoped trigger; the other widened columns have none. 2. docs/workflows.md was out of date, failing the docs-workflows check. Regenerated via npm run docs:workflows. NOTE: editing an in-sequence migration changes its checksum. This migration has been red in CI since it merged, so it has almost certainly never applied cleanly via migrate deploy anywhere; on any environment that did record it applied, run 'prisma migrate resolve' before the next deploy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50ad095 to
7c1d100
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50ad095de6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ALTER COLUMN "quantity" TYPE numeric(14,6), | ||
| ALTER COLUMN "reservedQty" TYPE numeric(14,6); | ||
|
|
||
| -- The stock_movements_reporting_evidence_guard constraint trigger (migration |
There was a problem hiding this comment.
Add the schema-scope marker so migration-scope passes
On a PR this still trips the schema guard before the fresh-db job: .github/workflows/schema-guardrails.yml runs node scripts/check-prisma-schema-scope.mjs "origin/${{ github.base_ref }}" HEAD, and that script fails any changed prisma/migrations/**/migration.sql without a matching prisma/schema.prisma change unless the migration file contains an exact -- prisma-schema-scope-ok: db-native... comment. I reproduced node scripts/check-prisma-schema-scope.mjs e510de09f37f7ae09e2174cb2ec030d62b947d43^ e510de09f37f7ae09e2174cb2ec030d62b947d43, and this migration is reported as unchecked, so the CI blocker remains for any PR carrying this trigger-only edit.
Useful? React with 👍 / 👎.
…QL (42P18)
The inventory invariant SQL collector passed STRANDED_TRANSFER_DAYS into a
jsonb_build_object value position without a type cast, so Postgres could not
determine the bind parameter's type ('could not determine data type of
parameter $42') and the whole inventory invariant report failed at runtime.
This surfaced only now that the migration fix lets invariant-preflight reach the
report on a fresh DB (unit tests use mocked clients, so the raw query never ran).
Cast it ::int, matching the same constant's already-cast use in the WHERE clause.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes the two pre-existing CI blockers that were red on every PR (not introduced by recent work — no recent PR touched migrations).
1. Migration trigger dependency (the real blocker)
20260619120000_cost_layer_qty_precision_14_6altersstock_movements.qtyto numeric(14,6), but thestock_movements_reporting_evidence_guardconstraint trigger (20260602103000) listsqtyin itsUPDATE OF ... qty ...column set, so Postgres refuses:cannot alter type of a column used in a trigger definition(P3018).prisma migrate deployfailed on a fresh DB, blocking e2e-select, invariant-preflight, and schema-guardrails(fresh-db-drift) entirely. Fix: drop the trigger around the column rewrite, recreate it identically (trigger function unchanged). Onlystock_movements.qtyhas a column-scoped trigger; the other widened columns have none.2. Stale workflow docs
docs/workflows.mdwas out of date (failingdocs-workflows). Regenerated.Validation: the
fresh-db-driftjob (migrate deploy on a fresh DB) is the real test — it was skipped on prior PRs since they didn't touchprisma/**. Watching CI.Migration-checksum note: this migration has been red in CI since it merged, so it has almost certainly never applied cleanly anywhere; any env that recorded it applied needs
prisma migrate resolvebefore its next deploy.🤖 Generated with Claude Code