Skip to content

Commit 60cb6d7

Browse files
committed
feat(tools): add test-migration tool
1 parent d9a38e6 commit 60cb6d7

5 files changed

Lines changed: 562 additions & 0 deletions

File tree

apps/cms/.env.local

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,12 @@ ETHEREAL_PASSWORD=
8181
# This is required when serving the app after running migrations locally.
8282
# Otherwise we'll probably run into race condition sync issues.
8383
DISABLE_DB_PUSH=false
84+
85+
86+
# Uncomment to run production backup locally after testing latest migration
87+
# (start the container via: pnpm cdwr → test-migration, choose to keep it running)
88+
# DATABASE_URL=postgresql://postgres:postgres@localhost:5435/cms
89+
# DEPLOY_ENV=production
90+
# DISABLE_DB_PUSH=true
91+
# SEED_SOURCE=off
92+
# TENANT_ID=

tools/cdwr-cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { backupCmsDatabase } from './db-tools/lib/backup-db.js';
66
import { dropDatabase } from './db-tools/lib/drop-db.js';
77
import { restoreCmsDatabase } from './db-tools/lib/restore-db.js';
88
import { syncCmsStorage } from './db-tools/lib/sync-storage.js';
9+
import { testMigration } from './db-tools/lib/test-migration.js';
910
import { showAppInfo } from './fly-tools/lib/app-info.js';
1011
import { patchFlyConfig } from './fly-tools/lib/patch-config.js';
1112
import { restartApp } from './fly-tools/lib/restart-app.js';
@@ -30,6 +31,11 @@ const tools: Tool[] = [
3031
description: 'Restore CMS database to Supabase',
3132
action: restoreCmsDatabase
3233
},
34+
{
35+
name: 'test-migration',
36+
description: 'Test latest migration against a production backup in Docker',
37+
action: testMigration
38+
},
3339
{
3440
name: 'sync-storage',
3541
description: 'Sync CMS media storage from Supabase S3',

0 commit comments

Comments
 (0)