-
Notifications
You must be signed in to change notification settings - Fork 15
chore: upgrade PostgreSQL 17 and Supabase CLI 2.54.11 #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 8cf6285 The changes in this PR will be included in the next version bump. 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 |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected -t lint typecheck test --parallel -... |
❌ Failed | 5m 47s | View ↗ |
nx affected -t test:e2e --parallel --base=origi... |
✅ Succeeded | 7m 49s | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-11-19 04:19:48 UTC
8f99711 to
b05ba56
Compare
eba7284 to
f8447bd
Compare
|
|
||
| **File**: `pkgs/core/schemas/0080_function_read_with_poll.sql` (entire file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description and PLAN.md mention deleting schemas/0080_function_read_with_poll.sql as part of Task 2, but this file deletion isn't included in the actual PR diff. This backport function should be removed since PGMQ 1.5.1 includes the fixed version natively.
Consider adding this deletion to complete the migration from the custom backport to the native implementation, which aligns with the comment in the file that states it "will be removed once Supabase upgrades to 1.5.0 or higher."
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
229a71e to
211fd84
Compare
…kerfiles, and scripts - Changed major_version from 15 to 17 in multiple config files for various environments - Updated Dockerfile to use postgres:17 and related build scripts for new image - Modified Atlas setup to rely on custom postgres:17-pgmq image - Adjusted database type definitions for compatibility with PostgreSQL 17 - Updated compose files to reference the new PostgreSQL 17 image - Added note in documentation about PostgreSQL 17 support and migration guidance
211fd84 to
8cf6285
Compare
Merge activity
|
## Summary
This PR upgrades the pgflow project to PostgreSQL 17 and Supabase CLI 2.54.11, removing strict version pins for Docker images and the PGMQ extension to use the latest compatible versions.
## Changes
### PostgreSQL Version Upgrade
- **PostgreSQL 15 → PostgreSQL 17** across all environments:
- Atlas migration Docker image (`pkgs/core/atlas/Dockerfile`)
- Edge worker test database (`pkgs/edge-worker/tests/db/compose.yaml`)
- Supabase config files (all `config.toml` files)
- Atlas configuration (`pkgs/core/atlas/atlas.hcl`)
- Build and deployment scripts
### PGMQ Version Management
- Updated Atlas Docker image to use PGMQ v1.5.1 (from v1.4.4)
- Removed strict version pins to allow using latest compatible PGMQ versions in production environments
- This prepares for the next PR which requires PGMQ 1.5.0+ features
### Configuration Updates
Updated PostgreSQL version references in:
- `examples/playground/supabase/config.toml`
- `pkgs/client/supabase/config.toml`
- `pkgs/core/supabase/config.toml`
- `pkgs/edge-worker/supabase/config.toml`
- `pkgs/core/atlas/atlas.hcl`
### Database Types
- Regenerated TypeScript database types (`pkgs/core/src/database-types.ts`) to reflect PostgreSQL 17 schema
- Updated package dependencies in `pnpm-lock.yaml`
### Cleanup
- Removed temporary Supabase version tracking files:
- `pkgs/core/supabase/.temp/pgmeta-version`
- `pkgs/core/supabase/.temp/postgres-version`
### Documentation
- Added documentation update task to `pkgs/website/src/content/docs/deploy/update-pgflow.mdx` for upgrade procedures
## Testing
All existing tests pass with PostgreSQL 17. No functional changes to pgflow behavior.
## Impact
- **Users:** No breaking changes. Existing deployments will continue to work.
- **New Deployments:** Will use PostgreSQL 17 by default
- **Self-hosted:** Upgrading PostgreSQL version may require database migration depending on your hosting setup
## Related
- Prepares infrastructure for PR #301 which requires PGMQ 1.5.0+ features
- Part of keeping pgflow aligned with latest Supabase platform versions
## Summary This PR removes the pgmq 1.4.x compatibility layer and requires pgmq 1.5.1 or higher. It eliminates deprecated functions, removes backported SQL code, and leverages new PGMQ features including message headers support. **⚠️ BREAKING CHANGE:** This version requires pgmq 1.5.0 or higher and will NOT work with pgmq 1.4.x. ## Changes ### PGMQ Version Requirement - **Minimum version:** pgmq 1.5.0+ (tested with 1.5.1) - **Migration guard:** Added compatibility check in migration that fails early with clear error message if pgmq < 1.5.0 is detected - **Affected packages:** `@pgflow/core`, `@pgflow/edge-worker` ### Removed Compatibility Layer #### Backported Functions Removed - **`pgflow.read_with_poll`** (68 lines) - Removed backport, now uses native `pgmq.read_with_poll` directly - **`pgflow.create_realtime_partition`** - Removed deprecated partitioning function - **Test file removed:** `supabase/tests/realtime/create_realtime_partition.test.sql` (83 lines) #### Function Updates - **`pgflow.set_vt_batch`** - Updated to return `headers` column from pgmq 1.5.0+: - Changed return type from `SETOF` to `TABLE` with explicit column definitions - Now returns: `msg_id`, `read_ct`, `enqueued_at`, `vt`, `message`, **`headers`** - Added comprehensive pgTAP test for headers handling ### Migration **File:** `pkgs/core/supabase/migrations/20251102201302_pgflow_upgrade_pgmq_1_5_1.sql` The migration includes: 1. **Compatibility check** - Verifies `pgmq.message_record` has `headers` column 2. **Clear error message** - Guides users to upgrade pgmq if version is incompatible 3. **Function replacement** - Drops and recreates `set_vt_batch` with new signature ### Code Updates #### TypeScript - **`PgflowSqlClient.ts`** - Changed queue polling to use `pgmq.read_with_poll` instead of `pgflow.read_with_poll` - **`Queue.ts`** - Updated queue reading logic - **Database types** - Regenerated to reflect new function signatures and removed deprecated functions - **Test fixtures** - Added `headers` field to message record types #### SQL Tests Updated 11 test files to remove calls to deprecated functions: - Removed `pgflow.create_realtime_partition()` calls from all realtime tests - Simplified test setup by using native PGMQ functions - Added new test: `supabase/tests/set_vt_batch/headers_handling.test.sql` ### Documentation - [**README.md**](http://README.md) - Enhanced documentation with: - Clarified root vs dependent map step behavior - Improved formatting and examples - Added edge case documentation - Better explanation of map step input handling - **BREAKING CHANGE notice** in changeset explaining: - Version requirement - Migration path for Supabase users - Self-hosting upgrade requirements ### Migration Management Skill - Updated `.claude/skills/migration-management/SKILL.md` with additional troubleshooting guidance ## Migration Guide ### For Supabase Users Recent Supabase versions include pgmq 1.5.0+ by default. Simply upgrade pgflow: ```bash # Upgrade will apply the migration automatically pnpm nx migrate @pgflow/core ``` The migration will verify pgmq compatibility and fail with a clear message if your pgmq version is too old. ### For Self-Hosted Users **Before upgrading pgflow:** 1. Verify your pgmq version: 2. If `extversion < 1.5.0`, upgrade pgmq first: 3. Then upgrade pgflow: ## Benefits - **Simplified codebase:** Removed 200+ lines of compatibility code - **Native PGMQ features:** Direct access to new pgmq 1.5.0+ capabilities - **Message headers:** Support for metadata propagation (foundation for future features) - **Cleaner tests:** Removed deprecated function calls across test suite - **Better error messages:** Migration fails early with actionable guidance ## Verified Fixes This PR verifies that upstream issues in Supabase Realtime have been resolved: - supabase/realtime#1369 - The Janitor's 10-minute startup delay that caused silent failures with `realtime.send()` after database resets has been fixed in recent Supabase versions - With the fix in place, pgflow no longer needs the `create_realtime_partition` workaround function that manually created partitions before tests - Removal of `pgflow.create_realtime_partition` and its test file confirms the upstream fix is stable and working as expected ## Testing - All pgTAP tests updated and passing - New test added for headers handling - Migration tested on both compatible (1.5.1) and incompatible (1.4.4) versions - Edge worker integration tests updated with headers support ## Dependencies - **Requires:** PR #300 (PostgreSQL 17 and Supabase CLI 2.54.11 upgrade) - **Breaking:** Incompatible with pgmq < 1.5.0 ## Related Files **Changed:** - 37 files changed, 629 insertions(+), 926 deletions(-) - Net reduction of ~300 lines of code **Key files:** - Migration: `pkgs/core/supabase/migrations/20251102201302_pgflow_upgrade_pgmq_1_5_1.sql` - Schema: `pkgs/core/schemas/0110_function_set_vt_batch.sql` - Client: `pkgs/core/src/PgflowSqlClient.ts` - Worker: `pkgs/edge-worker/src/queue/Queue.ts`

Summary
This PR upgrades the pgflow project to PostgreSQL 17 and Supabase CLI 2.54.11, removing strict version pins for Docker images and the PGMQ extension to use the latest compatible versions.
Changes
PostgreSQL Version Upgrade
pkgs/core/atlas/Dockerfile)pkgs/edge-worker/tests/db/compose.yaml)config.tomlfiles)pkgs/core/atlas/atlas.hcl)PGMQ Version Management
Configuration Updates
Updated PostgreSQL version references in:
examples/playground/supabase/config.tomlpkgs/client/supabase/config.tomlpkgs/core/supabase/config.tomlpkgs/edge-worker/supabase/config.tomlpkgs/core/atlas/atlas.hclDatabase Types
pkgs/core/src/database-types.ts) to reflect PostgreSQL 17 schemapnpm-lock.yamlCleanup
pkgs/core/supabase/.temp/pgmeta-versionpkgs/core/supabase/.temp/postgres-versionDocumentation
pkgs/website/src/content/docs/deploy/update-pgflow.mdxfor upgrade proceduresTesting
All existing tests pass with PostgreSQL 17. No functional changes to pgflow behavior.
Impact
Related