One migrator tweak

This commit is contained in:
James Agnew 2019-07-19 10:17:42 -04:00
parent f53746cd63
commit 6ff8484914
2 changed files with 8 additions and 8 deletions

View File

@ -41,10 +41,7 @@ import org.springframework.jdbc.core.ColumnMapRowMapper;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.*; import java.sql.*;
import java.util.HashSet; import java.util.*;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import static org.thymeleaf.util.StringUtils.toUpperCase; import static org.thymeleaf.util.StringUtils.toUpperCase;
@ -56,6 +53,10 @@ public class JdbcUtils {
*/ */
public static Set<String> getIndexNames(DriverTypeEnum.ConnectionProperties theConnectionProperties, String theTableName) throws SQLException { public static Set<String> getIndexNames(DriverTypeEnum.ConnectionProperties theConnectionProperties, String theTableName) throws SQLException {
if (!getTableNames(theConnectionProperties).contains(theTableName)) {
return Collections.emptySet();
}
DataSource dataSource = Objects.requireNonNull(theConnectionProperties.getDataSource()); DataSource dataSource = Objects.requireNonNull(theConnectionProperties.getDataSource());
try (Connection connection = dataSource.getConnection()) { try (Connection connection = dataSource.getConnection()) {
return theConnectionProperties.getTxTemplate().execute(t -> { return theConnectionProperties.getTxTemplate().execute(t -> {

View File

@ -86,10 +86,6 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
version.onTable("TRM_VALUESET") version.onTable("TRM_VALUESET")
.renameColumn("NAME", "VSNAME", true, true); .renameColumn("NAME", "VSNAME", true, true);
version.onTable("TRM_VALUESET_CONCEPT")
.renameColumn("CODE", "CODEVAL", true, true)
.renameColumn("SYSTEM", "SYSTEM_URL", true, true);
version.onTable("TRM_CONCEPT") version.onTable("TRM_CONCEPT")
.renameColumn("CODE", "CODEVAL", false, true); .renameColumn("CODE", "CODEVAL", false, true);
@ -127,6 +123,9 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.unique(false) .unique(false)
.withColumns("SYSTEM_URL", "CODEVAL"); .withColumns("SYSTEM_URL", "CODEVAL");
termValueSetConceptTable.addColumn("DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermConcept.MAX_DESC_LENGTH); termValueSetConceptTable.addColumn("DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermConcept.MAX_DESC_LENGTH);
version.onTable("TRM_VALUESET_CONCEPT")
.renameColumn("CODE", "CODEVAL", true, true)
.renameColumn("SYSTEM", "SYSTEM_URL", true, true);
// TermValueSetConceptDesignation // TermValueSetConceptDesignation
version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION"); version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION");