feat(deploy): sync schema to replication subscribers before migrating

Logical replication carries rows but not DDL, so a migration that adds a
column stalls every subscriber with "missing replicated columns" until the
column exists there too. _prisma_migrations is replicated, so migrate deploy
on a subscriber reports nothing pending while its tables lag behind.

sync-replica-schema.sh applies pending migrations to each subscriber first,
tracking them locally in _replica_ddl_applied, then migrates the publisher.
--check reports subscription state and columns missing on any replica.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-11 21:34:02 +03:30
co-authored by Cursor
parent aec5e08a1e
commit 515e39d420
5 changed files with 206 additions and 1 deletions
+3
View File
@@ -10,6 +10,9 @@ coverage
.env.local
.env.*.local
# replica DSNs contain live DB passwords
deploy/replicas.env
# SMS import target files may contain live DB passwords
prisma/khanegi-sms-targets.json
prisma/*-sms-targets.json