Fix MS SQLServer database migration
This commit is contained in:
parent
f1f9c672ad
commit
b6c8658f8c
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: fix
|
||||
issue: 3012
|
||||
title: "Fixes some recent database schema migration failures on MS SQLServer."
|
|
@ -221,6 +221,14 @@ public class TestUtil {
|
|||
|
||||
}
|
||||
|
||||
for (Class<?> innerClass : theClazz.getDeclaredClasses()) {
|
||||
Embeddable embeddable = innerClass.getAnnotation(Embeddable.class);
|
||||
if (embeddable != null) {
|
||||
scanClassOrSuperclass(theNames, innerClass, false, columnNameToLength);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (theClazz.getSuperclass().equals(Object.class)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -254,6 +254,13 @@ public class JdbcUtils {
|
|||
return new ColumnType(ColumnTypeEnum.DATE_TIMESTAMP, length);
|
||||
case Types.BLOB:
|
||||
return new ColumnType(ColumnTypeEnum.BLOB, length);
|
||||
case Types.VARBINARY:
|
||||
if (theConnectionProperties.getDriverType().equals(DriverTypeEnum.MSSQL_2012)) {
|
||||
// MS SQLServer seems to be mapping BLOB to VARBINARY under the covers, so we need to reverse that mapping
|
||||
return new ColumnType(ColumnTypeEnum.BLOB, length);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Don't know how to handle datatype " + dataType + " for column " + theColumnName + " on table " + theTableName);
|
||||
}
|
||||
case Types.CLOB:
|
||||
return new ColumnType(ColumnTypeEnum.CLOB, length);
|
||||
case Types.DOUBLE:
|
||||
|
|
|
@ -148,6 +148,11 @@ public class Builder {
|
|||
super.addTask(theTask);
|
||||
}
|
||||
}
|
||||
|
||||
public BuilderAddTableByColumns failureAllowed() {
|
||||
myTask.setFailureAllowed(true);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class BuilderWithTableName implements BaseMigrationTasks.IAcceptsTasks {
|
||||
|
|
Loading…
Reference in New Issue