mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 22:26:01 +00:00
preloaded data works
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
SqlObjectInfo,
|
||||
SqlDialect,
|
||||
TableInfo,
|
||||
NamedObjectInfo,
|
||||
} from '../../types';
|
||||
import { DatabaseInfoAlterProcessor } from './database-info-alter-processor';
|
||||
import { DatabaseAnalyser } from './DatabaseAnalyser';
|
||||
@@ -86,6 +87,13 @@ interface AlterOperation_RecreateTable {
|
||||
table: TableInfo;
|
||||
operations: AlterOperation[];
|
||||
}
|
||||
interface AlterOperation_FillPreloadedRows {
|
||||
operationType: 'fillPreloadedRows';
|
||||
table: NamedObjectInfo;
|
||||
oldRows: any[];
|
||||
newRows: any[];
|
||||
key: string[];
|
||||
}
|
||||
|
||||
type AlterOperation =
|
||||
| AlterOperation_CreateColumn
|
||||
@@ -101,7 +109,8 @@ type AlterOperation =
|
||||
| AlterOperation_RenameConstraint
|
||||
| AlterOperation_CreateSqlObject
|
||||
| AlterOperation_DropSqlObject
|
||||
| AlterOperation_RecreateTable;
|
||||
| AlterOperation_RecreateTable
|
||||
| AlterOperation_FillPreloadedRows;
|
||||
|
||||
export class AlterPlan {
|
||||
recreates = {
|
||||
@@ -223,6 +232,16 @@ export class AlterPlan {
|
||||
this.recreates.tables += 1;
|
||||
}
|
||||
|
||||
fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[]) {
|
||||
this.operations.push({
|
||||
operationType: 'fillPreloadedRows',
|
||||
table,
|
||||
oldRows,
|
||||
newRows,
|
||||
key,
|
||||
});
|
||||
}
|
||||
|
||||
run(processor: AlterProcessor) {
|
||||
for (const op of this.operations) {
|
||||
runAlterOperation(op, processor);
|
||||
@@ -545,6 +564,9 @@ export function runAlterOperation(op: AlterOperation, processor: AlterProcessor)
|
||||
case 'dropSqlObject':
|
||||
processor.dropSqlObject(op.oldObject);
|
||||
break;
|
||||
case 'fillPreloadedRows':
|
||||
processor.fillPreloadedRows(op.table, op.oldRows, op.newRows, op.key);
|
||||
break;
|
||||
case 'recreateTable':
|
||||
{
|
||||
const oldTable = generateTablePairingId(op.table);
|
||||
|
||||
Reference in New Issue
Block a user