driver tests

This commit is contained in:
Jan Prochazka
2024-12-11 14:07:06 +01:00
parent 10538a04b4
commit f72dbf19c2
6 changed files with 56 additions and 28 deletions

View File

@@ -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();

View File

@@ -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);

View File

@@ -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)',

View File

@@ -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);
}