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 = [
|
const filterLocal = [
|
||||||
// filter local testing
|
// filter local testing
|
||||||
'MySQL',
|
'-MySQL',
|
||||||
'-PostgreSQL',
|
'PostgreSQL',
|
||||||
'-SQL Server',
|
'-SQL Server',
|
||||||
'-SQLite',
|
'-SQLite',
|
||||||
'-CockroachDB',
|
'-CockroachDB',
|
||||||
|
@ -39,6 +39,7 @@ async function generateDeploySql({
|
|||||||
noRenameTable: true,
|
noRenameTable: true,
|
||||||
noRenameColumn: true,
|
noRenameColumn: true,
|
||||||
ignoreForeignKeyActions: true,
|
ignoreForeignKeyActions: true,
|
||||||
|
ignoreDataTypes: true,
|
||||||
};
|
};
|
||||||
const currentModelPaired = matchPairedObjects(deployedModel, currentModel, opts);
|
const currentModelPaired = matchPairedObjects(deployedModel, currentModel, opts);
|
||||||
// console.log('deployedModel', deployedModel.tables[0]);
|
// 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() {
|
transformPlan() {
|
||||||
// console.log('*****************OPERATIONS0', this.operations);
|
// console.log('*****************OPERATIONS0', this.operations);
|
||||||
|
|
||||||
@ -480,6 +491,10 @@ export class AlterPlan {
|
|||||||
this.operations = this._moveForeignKeysToLast();
|
this.operations = this._moveForeignKeysToLast();
|
||||||
|
|
||||||
// console.log('*****************OPERATIONS4', this.operations);
|
// console.log('*****************OPERATIONS4', this.operations);
|
||||||
|
|
||||||
|
this.operations = this._filterAllowedOperations();
|
||||||
|
|
||||||
|
// console.log('*****************OPERATIONS5', this.operations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,9 @@ export interface DbDiffOptions {
|
|||||||
noDropSqlObject?: boolean;
|
noDropSqlObject?: boolean;
|
||||||
noRenameTable?: boolean;
|
noRenameTable?: boolean;
|
||||||
noRenameColumn?: boolean;
|
noRenameColumn?: boolean;
|
||||||
|
|
||||||
ignoreForeignKeyActions?: boolean;
|
ignoreForeignKeyActions?: boolean;
|
||||||
|
ignoreDataTypes?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateTablePairingId(table: TableInfo): TableInfo {
|
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 = {}) {
|
export function testEqualTypes(a: ColumnInfo, b: ColumnInfo, opts: DbDiffOptions = {}) {
|
||||||
|
if (opts.ignoreDataTypes) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((a.dataType || '').toLowerCase() != (b.dataType || '').toLowerCase()) {
|
if ((a.dataType || '').toLowerCase() != (b.dataType || '').toLowerCase()) {
|
||||||
console.debug(
|
console.debug(
|
||||||
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different data type: ${a.dataType}, ${b.dataType}`
|
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different data type: ${a.dataType}, ${b.dataType}`
|
||||||
|
Loading…
Reference in New Issue
Block a user