mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 16:55:59 +00:00
alter table - change column dependencies
This commit is contained in:
@@ -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];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user