alter table - change column dependencies

This commit is contained in:
Jan Prochazka
2021-09-09 09:09:06 +02:00
parent e568adc825
commit b659136f64
3 changed files with 26 additions and 1 deletions

View File

@@ -222,6 +222,30 @@ export class AlterPlan {
];
return res;
}
if (op.operationType == 'changeColumn') {
const constraints = this._getDependendColumnConstraints(op.oldObject, this.dialect.changeColumnDependencies);
const res: AlterOperation[] = [
...constraints.map(oldObject => {
const opRes: AlterOperation = {
operationType: 'dropConstraint',
oldObject,
};
return opRes;
}),
op,
..._.reverse([...constraints]).map(newObject => {
const opRes: AlterOperation = {
operationType: 'createConstraint',
newObject,
};
return opRes;
}),
];
return res;
}
return [op];
});