UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

32 lines (31 loc) • 1.22 kB
import { o as hasUpdateDoctorMigrationCapture } from "./update-doctor-migration-attribution-Dp_N9vmd.mjs"; import { i as fingerprintPostgresBackup, n as capturePostgresBackup } from "./database-backup-B6k1k0NC.mjs"; import { randomUUID } from "node:crypto"; //#region src/commands/doctor-postgres-migration.ts /** Retain the exact predecessor under the same custody as the version runner. */ async function backupDoctorPostgresMigration(e, t, n) { const r = `${e}.pre-startup-migration-${randomUUID()}.postgres.bak`; const i = { database: { engine: "postgres", postgres: t } }; n.assertAdmission(); const a = hasUpdateDoctorMigrationCapture() ? void 0 : await fingerprintPostgresBackup(e, i); n.assertAdmission(); await capturePostgresBackup({ sourcePath: e, directory: r, profile: "exact", config: i, assertCurrent: () => n.assertAdmission() }); const o = a === void 0 ? void 0 : await fingerprintPostgresBackup(e, i); n.assertAdmission(); if (a !== void 0 && a !== o) throw new Error(`PostgreSQL changed during its pre-migration backup: ${e}`); return { changes: [`Saved pre-migration PostgreSQL backup: ${r}`], generation: o }; } //#endregion export { backupDoctorPostgresMigration };