fix(pg-delta): supabase add support for pgmq extension#191
Merged
Conversation
… output (#154) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: avallete <8771783+avallete@users.noreply.github.com> Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com> Co-authored-by: avallete <andrew.valleteau@supabase.io>
🦋 Changeset detectedLatest commit: 7bdaf92 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
avallete
commented
Apr 14, 2026
Member
Author
avallete
left a comment
There was a problem hiding this comment.
Most of the changes are about adding a _options: SerializeOptions into every serialize change implementation, so downstream dsl filter can have some typing correctly infered.
Real changes are in:
packages/pg-delta/src/core/integrations/supabase.ts
packages/pg-delta/tests/integration/pgmq-declarative-roundtrip.test.ts
commit: |
jgoux
approved these changes
Apr 15, 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.
Summary
Fixes declarative schema apply failing for projects using the
pgmqextension when the Supabase integration exports extension DDL that includesWITH SCHEMA pgmq, whileCREATE SCHEMA pgmqis not part of the exported set (system schema filtering). Also formalizesSerializeOptionsso integration serialize rules andChange.serialize()share one typed contract, documents those types in TypeDoc, and adds a regression test for the export → apply pipeline.Problem
PostgreSQL requires the target schema to already exist before
CREATE EXTENSION … WITH SCHEMA <schema>. On a fresh database (e.g. shadow DB / clean apply), thepgmqschema typically does not exist yet. Thepgmqextension creates that schema as part of installation, but the server validatesWITH SCHEMAbefore running the extension scripts—soCREATE EXTENSION pgmq WITH SCHEMA pgmqfails withschema "pgmq" does not existunless something else has pre-createdpgmq.Separately, wiring serialize options through the integration DSL exposed a typing gap: the
Changeunion did not consistently acceptserialize(options)until concrete change types aligned on a shared options type.Solution
pgmqextension creates so emitted SQL omitsWITH SCHEMA(plainCREATE EXTENSION pgmq;), avoiding the invalid ordering on a fresh database when the schema create is not exported.SerializeOptionsinserialize.types.ts, used bycompileSerializeDSL,BaseChange.serialize, and concrete serializers;CreateExtensionhonorsskipSchemawhere applicable.pgmqsetup; unit coverage for DSL / extension serialization behavior.@supabase/pg-delta.