mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 20:35:59 +00:00
handle sparse, zerofill, unsigned, commant flags
This commit is contained in:
@@ -181,6 +181,8 @@ export class SqlDumper implements AlterProcessor {
|
||||
this.put(' ^auto_increment');
|
||||
}
|
||||
|
||||
specialColumnOptions(column) {}
|
||||
|
||||
columnDefinition(column: ColumnInfo, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
||||
if (column.computedExpression) {
|
||||
this.put('^as %s', column.computedExpression);
|
||||
@@ -193,9 +195,7 @@ export class SqlDumper implements AlterProcessor {
|
||||
}
|
||||
|
||||
this.putRaw(' ');
|
||||
if (column.isSparse) {
|
||||
this.put(' ^sparse ');
|
||||
}
|
||||
this.specialColumnOptions(column);
|
||||
if (includeNullable) {
|
||||
this.put(column.notNull ? '^not ^null' : '^null');
|
||||
}
|
||||
|
||||
@@ -217,6 +217,24 @@ export function testEqualColumns(
|
||||
// opts.DiffLogger.Trace('Column {0}, {1}: different is_sparse: {2}; {3}', a, b, a.IsSparse, b.IsSparse);
|
||||
return false;
|
||||
}
|
||||
if ((a.isUnsigned || false) != (b.isUnsigned || false)) {
|
||||
console.debug(
|
||||
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different unsigned: ${a.isUnsigned}, ${b.isUnsigned}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if ((a.isZerofill || false) != (b.isZerofill || false)) {
|
||||
console.debug(
|
||||
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different zerofill: ${a.isZerofill}, ${b.isZerofill}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if ((a.columnComment || '') != (b.columnComment || '')) {
|
||||
console.debug(
|
||||
`Column ${a.pureName}.${a.columnName}, ${b.pureName}.${b.columnName}: different comment: ${a.columnComment}, ${b.columnComment}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!testEqualTypes(a, b, opts)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user