added proxy indicator for hash indexes migration having been run (used TRM_CONCEPT_DESIG table existence)

This commit is contained in:
Ken Stevens 2019-11-02 21:30:40 -04:00
parent 6356205768
commit 8887d41283
1 changed files with 10 additions and 4 deletions

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.migrate.taskdef;
* #L% * #L%
*/ */
import ca.uhn.fhir.jpa.migrate.JdbcUtils;
import ca.uhn.fhir.util.StopWatch; import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.util.VersionEnum; import ca.uhn.fhir.util.VersionEnum;
import com.google.common.collect.ForwardingMap; import com.google.common.collect.ForwardingMap;
@ -33,10 +34,7 @@ import org.springframework.jdbc.core.RowCallbackHandler;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.function.Function; import java.util.function.Function;
@ -65,6 +63,14 @@ public class CalculateHashesTask extends BaseTableColumnTask<CalculateHashesTask
return; return;
} }
Set<String> tableNames = JdbcUtils.getTableNames(getConnectionProperties());
// This table was added a few days after hash indexes were added, so it is a reasonable indicator for whether this
// migration has already been run
if (tableNames.contains("TRM_CONCEPT_DESIG")) {
logInfo(ourLog, "The table TRM_CONCEPT_DESIG already exists. Skipping calculate hashes task.");
return;
}
initializeExecutor(); initializeExecutor();
try { try {