db deploy fixes

This commit is contained in:
SPRINX0\prochazka
2024-10-29 14:28:26 +01:00
parent 456d3ba42e
commit 2704825d03
17 changed files with 184 additions and 30 deletions

View File

@@ -498,22 +498,25 @@ export class AlterPlan {
return this.operations;
}
const fks = [];
const res = this.operations.map(op => {
if (op.operationType == 'createTable') {
fks.push(...(op.newObject.foreignKeys || []));
return {
...op,
newObject: {
...op.newObject,
foreignKeys: [],
},
};
}
return op;
});
const res = this.operations
.filter(op => op.operationType != 'createConstraint')
.map(op => {
if (op.operationType == 'createTable') {
fks.push(...(op.newObject.foreignKeys || []));
return {
...op,
newObject: {
...op.newObject,
foreignKeys: [],
},
};
}
return op;
});
return [
...res,
...this.operations.filter(op => op.operationType == 'createConstraint'),
...fks.map(
fk =>
({