mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 01:46:02 +00:00
driver tests
This commit is contained in:
@@ -132,7 +132,9 @@ class MsSqlDumper extends SqlDumper {
|
||||
} else {
|
||||
this.dropDefault(oldcol);
|
||||
if (oldcol.columnName != newcol.columnName) this.renameColumn(oldcol, newcol.columnName);
|
||||
this.fillNewNotNullDefaults(newcol);
|
||||
if (!oldcol.notNull) {
|
||||
this.fillNewNotNullDefaults(newcol);
|
||||
}
|
||||
this.put('^alter ^table %f ^alter ^column %i ', oldcol, oldcol.columnName, newcol.columnName);
|
||||
this.columnDefinition(newcol, { includeDefault: false });
|
||||
this.endCommand();
|
||||
|
||||
@@ -32,10 +32,12 @@ class Dumper extends SqlDumper {
|
||||
}
|
||||
|
||||
changeColumn(oldcol, newcol, constraints) {
|
||||
this.fillNewNotNullDefaults({
|
||||
...newcol,
|
||||
columnName: oldcol.columnName,
|
||||
});
|
||||
if (!oldcol.notNull) {
|
||||
this.fillNewNotNullDefaults({
|
||||
...newcol,
|
||||
columnName: oldcol.columnName,
|
||||
});
|
||||
}
|
||||
this.put('^alter ^table %f ^change ^column %i %i ', oldcol, oldcol.columnName, newcol.columnName);
|
||||
this.columnDefinition(newcol);
|
||||
this.inlineConstraints(constraints);
|
||||
|
||||
@@ -92,6 +92,10 @@ class Dumper extends SqlDumper {
|
||||
this.putCmd('^alter ^table %f ^rename ^column %i ^to %i', oldcol, oldcol.columnName, newcol.columnName);
|
||||
}
|
||||
|
||||
if (!oldcol.notNull) {
|
||||
this.fillNewNotNullDefaults(newcol);
|
||||
}
|
||||
|
||||
if (!testEqualTypes(oldcol, newcol) || oldcol.notNull != newcol.notNull) {
|
||||
this.putCmd(
|
||||
'^alter ^table %f ^modify (%i %s %k)',
|
||||
|
||||
@@ -89,7 +89,9 @@ class Dumper extends SqlDumper {
|
||||
}
|
||||
}
|
||||
if (oldcol.notNull != newcol.notNull) {
|
||||
this.fillNewNotNullDefaults(newcol);
|
||||
if (!oldcol.notNull) {
|
||||
this.fillNewNotNullDefaults(newcol);
|
||||
}
|
||||
if (newcol.notNull) this.putCmd('^alter ^table %f ^alter ^column %i ^set ^not ^null', newcol, newcol.columnName);
|
||||
else this.putCmd('^alter ^table %f ^alter ^column %i ^drop ^not ^null', newcol, newcol.columnName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user