Fix forced ID migration for MSSQL (#6290)

Co-authored-by: Primož Delopst <primoz.delopst@better.care>
This commit is contained in:
Primož Delopst 2024-09-24 16:43:17 +02:00 committed by GitHub
parent fb93c3d601
commit 4aea94ccb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 1 deletions

View File

@ -89,7 +89,7 @@ public class ForceIdMigrationFixTask extends BaseTask {
" set fhir_id = coalesce( "
+
// case 5.
" trim(fhir_id), "
trimFhirId()
+
// case 3
" (select f.forced_id from hfj_forced_id f where f.resource_pid = res_id), "
@ -109,6 +109,22 @@ public class ForceIdMigrationFixTask extends BaseTask {
}
}
private String trimFhirId() {
switch (getDriverType()) {
case MSSQL_2012:
return " LTRIM(RTRIM(fhir_id)), ";
case H2_EMBEDDED:
case DERBY_EMBEDDED:
case MARIADB_10_1:
case MYSQL_5_7:
case POSTGRES_9_4:
case ORACLE_12C:
case COCKROACHDB_21_1:
default:
return " trim(fhir_id), ";
}
}
private String getWhereClauseByDBType() {
switch (getDriverType()) {
case MSSQL_2012: