Merge pull request #3013 from hapifhir/jr-20210921-mssql-data-migration

Fix MS SQLServer database migration
This commit is contained in:
JasonRoberts-smile 2021-09-21 14:02:57 -04:00 committed by GitHub
commit d5c6461e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 3012
title: "Fixes migration of VARBINARY columns on MS SQLServer."

View File

@ -220,6 +220,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;
}

View File

@ -185,6 +185,13 @@ public class JdbcUtils {
return new ColumnType(ColumnTypeEnum.DATE_TIMESTAMP, length);
case Types.BLOB:
return new ColumnType(ColumnTypeEnum.BLOB, length);
case Types.VARBINARY:
if (DriverTypeEnum.MSSQL_2012.equals(theConnectionProperties.getDriverType())) {
// 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:

View File

@ -526,6 +526,11 @@ public class Builder {
super.addTask(theTask);
}
}
public BuilderAddTableByColumns failureAllowed() {
myTask.setFailureAllowed(true);
return this;
}
}
}