You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(postgres): derive version from cloudsync.h, ship upgrade scripts
Before this change, default_version in the control file was frozen at
'1.0' across all 16 releases. Every user's pg_extension.extversion
reported '1.0' regardless of which .so they ran, no per-release upgrade
scripts existed, and no CI check flagged missing ones — so a version
bump could silently leave users unable to reach the new release via
`ALTER EXTENSION cloudsync UPDATE` and force them into a destructive
DROP EXTENSION ... CASCADE; CREATE EXTENSION ... workaround.
Single source of truth: the PG extension version is now derived from
CLOUDSYNC_VERSION in src/cloudsync.h (what the rest of the repo already
tracks). docker/Makefile.postgresql reads it and generates
cloudsync.control and cloudsync--<version>.sql at build time from new
.in templates; the generated files are gitignored.
Per-release upgrade scripts live under src/postgresql/migrations/ as
cloudsync--<from>--<to>.sql and are picked up by postgres-install,
postgres-package, and all three release Dockerfiles via wildcard.
Bootstrap: cloudsync--1.0--1.0.17.sql (comment-only, no SQL surface
changes) lets existing extversion='1.0' deployments upgrade cleanly.
CI gate: scripts/check-postgres-migration.sh + a postgres-check-migration
Make target + a new postgres-migration-check workflow job (both
postgres-test and postgres-build now block on it) resolve the previous
release's extversion from the most recent semver tag's control file (or
CLOUDSYNC_VERSION at that tag for new-scheme tags) and fail the build
if cloudsync--<prev>--<curr>.sql is missing. Sub-second; runs on every PR.
Also: bumped CLOUDSYNC_VERSION to 1.0.17; taught Dockerfile.supabase to
accept CLOUDSYNC_VERSION as a build arg for the image label; swept
version-hardcoded filenames out of docker/README.md,
docs/internal/supabase-flyio.md, and docs/postgresql/quickstarts/postgres.md.
Verified end-to-end: rebuilt the local debug container with a persistent
volume at installed_version='1.0', ran `ALTER EXTENSION cloudsync UPDATE;`,
confirmed installed_version moved to '1.0.17'.
Copy file name to clipboardExpand all lines: docs/internal/supabase-flyio.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,10 +86,10 @@ The `make postgres-supabase-build` command does the following:
86
86
1.**Pulls the official Supabase Postgres base image** (e.g., `public.ecr.aws/supabase/postgres:15.8.1.085`) — this is Supabase's standard PostgreSQL image that ships with ~30 extensions pre-installed (PostGIS, pgvector, etc.)
87
87
2.**Runs a multi-stage Docker build** using `docker/postgresql/Dockerfile.supabase`:
88
88
-**Stage 1 (builder)**: Installs C build tools (`gcc`, `make`), copies the CloudSync source code (`src/`, `modules/`), and compiles `cloudsync.so` against Supabase's `pg_config`
89
-
-**Stage 2 (runtime)**: Starts from a clean Supabase Postgres image and copies in just three files:
89
+
-**Stage 2 (runtime)**: Starts from a clean Supabase Postgres image and copies in just three kinds of file:
90
90
-`cloudsync.so` — the compiled extension binary
91
-
-`cloudsync.control` — tells PostgreSQL the extension's name and version
92
-
-`cloudsync--1.0.sql` — the SQL that defines all CloudSync functions
91
+
-`cloudsync.control` — tells PostgreSQL the extension's name and default version (generated at build time from `cloudsync.control.in`, with the version read from `src/cloudsync.h`)
92
+
-`cloudsync--<version>.sql` — the SQL that defines all CloudSync functions for the current release (e.g. `cloudsync--1.0.16.sql`), plus any `cloudsync--<from>--<to>.sql` upgrade scripts shipped under `src/postgresql/migrations/`
93
93
3.**Tags the result** with the same name as the base image, so it's a drop-in replacement
94
94
95
95
To find the correct tag, clone the Supabase repo and check:
@@ -118,7 +118,8 @@ Verify CloudSync is installed inside the image:
118
118
```bash
119
119
docker run --rm <your-dockerhub-username>/supabase-postgres-cloudsync:15.8.1.085 \
120
120
find / -name "cloudsync*" -type f 2>/dev/null
121
-
# Should list cloudsync.so, cloudsync.control, and cloudsync--1.0.sql
121
+
# Should list cloudsync.so, cloudsync.control, and cloudsync--<version>.sql
122
+
# (plus any cloudsync--<from>--<to>.sql upgrade scripts)
122
123
# in /nix/store/...-postgresql-and-plugins-15.8/ paths
0 commit comments