Skip to content

Commit fa42fe1

Browse files
NiallJoeMaherclaude
andcommitted
fix(cdk): upgrade RDS Postgres 14.5 -> 15.8 to match schema (NULLS NOT DISTINCT)
Migration 0029 adds `UNIQUE NULLS NOT DISTINCT` on point_event (the dedupe / anti-gaming key), which is Postgres 15+ syntax. The RDS instance was pinned to 14.5, so `db:migrate` failed on every Vercel deploy. Bump the engine to 15.8 (local dev already runs postgres:15-alpine) and set allowMajorVersionUpgrade so RDS accepts the major-version change. NOTE: requires `cdk deploy` of the StorageStack to take effect (in-place RDS major upgrade, brief downtime). Vercel stays red until that deploy completes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1ba6c4a commit fa42fe1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎cdk/lib/storage-stack.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ export class StorageStack extends cdk.Stack {
145145
instanceIdentifier: "codu-rds",
146146
databaseName: dbName,
147147
engine: rds.DatabaseInstanceEngine.postgres({
148-
version: rds.PostgresEngineVersion.VER_14_5,
148+
// PG15+ is required by the schema (point_event dedupe uses
149+
// `UNIQUE NULLS NOT DISTINCT`, added in Postgres 15). Local dev runs
150+
// postgres:15-alpine; this keeps RDS in step.
151+
version: rds.PostgresEngineVersion.VER_15_8,
149152
}),
150153
credentials: rds.Credentials.fromPassword(
151154
dbUsername,
@@ -164,6 +167,10 @@ export class StorageStack extends cdk.Stack {
164167
publiclyAccessible: true,
165168
deletionProtection: props?.production ?? false,
166169
autoMinorVersionUpgrade: true,
170+
// Required for the 14.5 -> 15.x major-version upgrade; RDS rejects a
171+
// major engine change without it. Safe to leave enabled (it permits, it
172+
// doesn't force, future major upgrades via CDK).
173+
allowMajorVersionUpgrade: true,
167174
backupRetention: props?.production
168175
? cdk.Duration.days(7) // 7 days retention for production
169176
: cdk.Duration.days(1), // 1 day retention for non-production (minimum allowed)

0 commit comments

Comments
 (0)