feat(postgres): export all schemas in one SQL file

This commit is contained in:
zipg authored and GitHub committed 2026-09-07 23:20:46 +08:00
1 parent 0bacb5effd
commit 5efbe360d9
15 files changed
+452 -38

No files matched your search

@@ -166,6 +166,17 @@ export function buildAllDatabaseExportPlan(options: AllDatabaseExportPlanInput):
displayName: schema,
}));
}
// PostgreSQL supports multiple schemas in one database. Keep the database
// as the export unit so the backend can produce one restore script for all
// schemas instead of one file per schema.
if (options.dbType === "postgres" && options.schemaAware) {
return options.databases.map((database) => ({
database,
schema: "",
fileStem: database,
displayName: database,
}));
}
return options.databases.flatMap((database) => {
const schemas = options.schemaAware ? filterExportableSchemas(options.schemasByDatabase?.[database] ?? [], options.dbType).filter((schema) => schema.trim()) : [database];
const exportSchemas = schemas.length > 0 ? schemas : [database];