Skip to content

Fix PostgreSQL migration dependency order - #31

Draft
joe-thom wants to merge 1 commit into
mainfrom
joe-thom/fix-postgres-statement-order
Draft

Fix PostgreSQL migration dependency order#31
joe-thom wants to merge 1 commit into
mainfrom
joe-thom/fix-postgres-statement-order

Conversation

@joe-thom

@joe-thom joe-thom commented Sep 8, 2026

Copy link
Copy Markdown

Summary

PostgreSQL migrations now create columns before primary keys that use them. They also create unique constraints and indexes before dependent foreign keys.

Why

The 0.32.x differ can emit a replacement composite primary key before its new column. It can also emit a foreign key before the parent uniqueness that validates the reference. PostgreSQL rejects both migration orders.

References CLO2-227

What changed

  • Mirrors the dependency phases from Drizzle v1 RC4 in the legacy PostgreSQL differ.
  • Adds regressions for a new column used by a replacement primary key.
  • Adds a regression for a new parent unique constraint used by a foreign key.
  • Prepares @drizzle-team/drizzle-kit@0.32.4 for the internal release.

Validation

The full PostgreSQL table-diff test file passes with 32 tests. The two new tests fail on 0.32.3 and pass with this change.

The format check and package typecheck pass. The JavaScript bundles and declarations build successfully. The local attw packaging step then crashes while it reads the package export conditions.

The GitHub release matrix stops during dependency installation. The public registry returns 404 for the existing drizzle-kit@0.25.0-b1faa33 development dependency, before any tests start.

Rollout and rollback

This PR only prepares the package release. Managed Publish changes after 0.32.4 is published and pid2 consumes it in a separate PR. A package downgrade safely rolls back the change.

~ written by Zerg 馃懢 (wp-e307c37c)

@joe-thom joe-thom added the zergling-authored Authored by a Zerg zergling label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zergling-authored Authored by a Zerg zergling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant