preloadedRows insert only implementation

This commit is contained in:
Jan Prochazka
2021-12-09 18:26:10 +01:00
parent 7ad845d5c6
commit 1a0d5457ce
7 changed files with 13 additions and 7 deletions

View File

@@ -606,7 +606,7 @@ export class SqlDumper implements AlterProcessor {
this.putCmd('^drop %s %f', this.getSqlObjectSqlName(obj.objectTypeField), obj);
}
fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[]) {
fillPreloadedRows(table: NamedObjectInfo, oldRows: any[], newRows: any[], key: string[], insertOnly: string[]) {
let was = false;
for (const row of newRows) {
const old = oldRows?.find(r => key.every(col => r[col] == row[col]));
@@ -614,7 +614,7 @@ export class SqlDumper implements AlterProcessor {
if (old) {
const updated = [];
for (const col of rowKeys) {
if (row[col] != old[col]) {
if (row[col] != old[col] && !insertOnly?.includes(col)) {
updated.push(col);
}
}