mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
alter processor fixes
This commit is contained in:
parent
cb64a43a78
commit
be1c1075b5
@ -116,8 +116,8 @@ const engines = [
|
||||
|
||||
const filterLocal = [
|
||||
// filter local testing
|
||||
'MySQL',
|
||||
'-PostgreSQL',
|
||||
'-MySQL',
|
||||
'PostgreSQL',
|
||||
'-SQL Server',
|
||||
'-SQLite',
|
||||
'-CockroachDB',
|
||||
|
@ -39,6 +39,7 @@ async function generateDeploySql({
|
||||
noRenameTable: true,
|
||||
noRenameColumn: true,
|
||||
ignoreForeignKeyActions: true,
|
||||
ignoreDataTypes: true,
|
||||
};
|
||||
const currentModelPaired = matchPairedObjects(deployedModel, currentModel, opts);
|
||||
// console.log('deployedModel', deployedModel.tables[0]);
|
||||
|
@ -462,6 +462,17 @@ export class AlterPlan {
|
||||
];
|
||||
}
|
||||
|
||||
_filterAllowedOperations(): AlterOperation[] {
|
||||
return this.operations.filter(op => {
|
||||
if (this.opts.noDropColumn && op.operationType == 'dropColumn') return false;
|
||||
if (this.opts.noDropTable && op.operationType == 'dropTable') return false;
|
||||
if (this.opts.noDropTable && op.operationType == 'recreateTable') return false;
|
||||
if (this.opts.noDropConstraint && op.operationType == 'dropConstraint') return false;
|
||||
if (this.opts.noDropSqlObject && op.operationType == 'dropSqlObject') return false;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
transformPlan() {
|
||||
// console.log('*****************OPERATIONS0', this.operations);
|
||||
|
||||
@ -480,6 +491,10 @@ export class AlterPlan {
|
||||
this.operations = this._moveForeignKeysToLast();
|
||||
|
||||
// console.log('*****************OPERATIONS4', this.operations);
|
||||
|
||||
this.operations = this._filterAllowedOperations();
|
||||
|
||||
// console.log('*****************OPERATIONS5', this.operations);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,9 @@ export interface DbDiffOptions {
|
||||
noDropSqlObject?: boolean;
|
||||
noRenameTable?: boolean;
|
||||
noRenameColumn?: boolean;
|
||||
|
||||
ignoreForeignKeyActions?: boolean;
|
||||
ignoreDataTypes?: boolean;
|
||||
}
|
||||
|
||||
export function generateTablePairingId(table: TableInfo): TableInfo {
|
||||
@ -275,6 +277,10 @@ function testEqualConstraints(a: ConstraintInfo, b: ConstraintInfo, opts: DbDiff
|
||||
}
|
||||
|
||||
export function testEqualTypes(a: ColumnInfo, b: ColumnInfo, opts: DbDiffOptions = {}) {
|
||||
if (opts.ignoreDataTypes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((a.dataType || '').toLowerCase() != (b.dataType || '').toLowerCase()) {
|
||||
console.debug(
|
||||
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different data type: ${a.dataType}, ${b.dataType}`
|
||||
|
Loading…
Reference in New Issue
Block a user