From 6bd81cbff59c67f3a40f6efce9467ad27dca3d2c Mon Sep 17 00:00:00 2001 From: "SPRINX0\\prochazka" Date: Mon, 1 Dec 2025 12:17:00 +0100 Subject: [PATCH] restore table - comments --- packages/types/dumper.d.ts | 1 + packages/web/src/utility/tableRestoreScript.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/types/dumper.d.ts b/packages/types/dumper.d.ts index 746cbbfc2..c5f380a22 100644 --- a/packages/types/dumper.d.ts +++ b/packages/types/dumper.d.ts @@ -16,6 +16,7 @@ export interface SqlDumper extends AlterProcessor { transform(type: TransformType, dumpExpr: () => void); createDatabase(name: string); dropDatabase(name: string); + comment(value: string); callableTemplate(func: CallableObjectInfo); diff --git a/packages/web/src/utility/tableRestoreScript.ts b/packages/web/src/utility/tableRestoreScript.ts index 072d8a441..ae768f5ea 100644 --- a/packages/web/src/utility/tableRestoreScript.ts +++ b/packages/web/src/utility/tableRestoreScript.ts @@ -30,6 +30,21 @@ export function createTableRestoreScript(backupTable: TableInfo, originalTable: }; } + function putTitle(title: string) { + dmp.putRaw('\n\n'); + dmp.comment(`******************** ${title} ********************`); + dmp.putRaw('\n'); + } + + dmp.comment(`Restoring data into table ${originalTable.pureName} from backup table ${backupTable.pureName}`); + dmp.putRaw('\n'); + dmp.comment(`Key columns: ${keyColumns.join(', ')}`); + dmp.putRaw('\n'); + dmp.comment(`Value columns: ${valueColumns.join(', ')}`); + dmp.putRaw('\n'); + dmp.comment(`Follows UPDATE, DELETE, INSERT statements to restore data`); + dmp.putRaw('\n'); + const update: Update = { commandType: 'update', from: { name: originalTable }, @@ -71,6 +86,7 @@ export function createTableRestoreScript(backupTable: TableInfo, originalTable: }, }, }; + putTitle('UPDATE'); dumpSqlUpdate(dmp, update); dmp.endCommand(); @@ -90,6 +106,7 @@ export function createTableRestoreScript(backupTable: TableInfo, originalTable: }, }, }; + putTitle('DELETE'); dumpSqlDelete(dmp, delcmd); dmp.endCommand(); @@ -109,6 +126,7 @@ export function createTableRestoreScript(backupTable: TableInfo, originalTable: }, }; + putTitle('INSERT'); dumpSqlInsert(dmp, insert); dmp.endCommand(); }