mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 16:36:00 +00:00
force recreate table when changing autoincrement flag
This commit is contained in:
@@ -416,6 +416,12 @@ export class AlterPlan {
|
||||
this._testTableRecreate(op, 'createConstraint', obj => this._canCreateConstraint(obj), 'newObject') ||
|
||||
this._testTableRecreate(op, 'dropConstraint', obj => this._canDropConstraint(obj), 'oldObject') ||
|
||||
this._testTableRecreate(op, 'changeColumn', this.dialect.changeColumn, 'newObject') ||
|
||||
this._testTableRecreate(
|
||||
op,
|
||||
'changeColumn',
|
||||
obj => this._canChangeAutoIncrement(obj, op as AlterOperation_ChangeColumn),
|
||||
'newObject'
|
||||
) ||
|
||||
this._testTableRecreate(op, 'renameColumn', true, 'object') || [op]
|
||||
);
|
||||
});
|
||||
@@ -443,6 +449,13 @@ export class AlterPlan {
|
||||
return null;
|
||||
}
|
||||
|
||||
_canChangeAutoIncrement(column: ColumnInfo, op: AlterOperation_ChangeColumn) {
|
||||
if (!!column.autoIncrement != !!op.oldObject.autoIncrement) {
|
||||
return this.dialect.changeAutoIncrement;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
_testTableRecreate(
|
||||
op: AlterOperation,
|
||||
operationType: string,
|
||||
|
||||
Reference in New Issue
Block a user