Drop unnecessary index (#1696)
This commit is contained in:
parent
218f344945
commit
709aeb4ae8
|
@ -21,8 +21,6 @@ package ca.uhn.fhir.jpa.dao.data;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation;
|
import ca.uhn.fhir.jpa.entity.TermValueSetConceptDesignation;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Slice;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
@ -37,6 +35,4 @@ public interface ITermValueSetConceptDesignationDao extends JpaRepository<TermVa
|
||||||
@Modifying
|
@Modifying
|
||||||
void deleteByTermValueSetId(@Param("pid") Long theValueSetId);
|
void deleteByTermValueSetId(@Param("pid") Long theValueSetId);
|
||||||
|
|
||||||
@Query("SELECT vscd FROM TermValueSetConceptDesignation vscd WHERE vscd.myConcept.myId = :pid")
|
|
||||||
Slice<TermValueSetConceptDesignation> findByTermValueSetConceptId(Pageable thePage, @Param("pid") Long theValueSetConceptId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,7 @@ import java.io.Serializable;
|
||||||
import static org.apache.commons.lang3.StringUtils.left;
|
import static org.apache.commons.lang3.StringUtils.left;
|
||||||
import static org.apache.commons.lang3.StringUtils.length;
|
import static org.apache.commons.lang3.StringUtils.length;
|
||||||
|
|
||||||
@Table(name = "TRM_VALUESET_C_DESIGNATION", indexes = {
|
@Table(name = "TRM_VALUESET_C_DESIGNATION")
|
||||||
@Index(name = "IDX_VALUESET_C_DSGNTN_VAL", columnList = "VAL")
|
|
||||||
})
|
|
||||||
@Entity()
|
@Entity()
|
||||||
public class TermValueSetConceptDesignation implements Serializable {
|
public class TermValueSetConceptDesignation implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -186,6 +186,10 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
||||||
// TermConceptProperty
|
// TermConceptProperty
|
||||||
version.startSectionWithMessage("Processing table: TRM_CONCEPT_PROPERTY");
|
version.startSectionWithMessage("Processing table: TRM_CONCEPT_PROPERTY");
|
||||||
version.onTable("TRM_CONCEPT_PROPERTY").addColumn("20191002.9", "PROP_VAL_LOB").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB);
|
version.onTable("TRM_CONCEPT_PROPERTY").addColumn("20191002.9", "PROP_VAL_LOB").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.BLOB);
|
||||||
|
|
||||||
|
// TermValueSetConceptDesignation
|
||||||
|
version.onTable("TRM_VALUESET_C_DESIGNATION").dropIndex("20200202.1", "IDX_VALUESET_C_DSGNTN_VAL").failureAllowed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init400() { // 20190401 - 20190814
|
protected void init400() { // 20190401 - 20190814
|
||||||
|
@ -324,10 +328,13 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
||||||
termValueSetConceptDesignationTable.addColumn("USE_CODE").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
termValueSetConceptDesignationTable.addColumn("USE_CODE").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
||||||
termValueSetConceptDesignationTable.addColumn("USE_DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
termValueSetConceptDesignationTable.addColumn("USE_DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
||||||
termValueSetConceptDesignationTable.addColumn("VAL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
termValueSetConceptDesignationTable.addColumn("VAL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 500);
|
||||||
|
|
||||||
|
// This index turned out not to be needed so it is disabled
|
||||||
termValueSetConceptDesignationTable
|
termValueSetConceptDesignationTable
|
||||||
.addIndex("20190801.6", "IDX_VALUESET_C_DSGNTN_VAL")
|
.addIndex("20190801.6", "IDX_VALUESET_C_DSGNTN_VAL")
|
||||||
.unique(false)
|
.unique(false)
|
||||||
.withColumns("VAL");
|
.withColumns("VAL")
|
||||||
|
.doNothing();
|
||||||
|
|
||||||
// TermCodeSystemVersion
|
// TermCodeSystemVersion
|
||||||
version.startSectionWithMessage("Processing table: TRM_CODESYSTEM_VER");
|
version.startSectionWithMessage("Processing table: TRM_CODESYSTEM_VER");
|
||||||
|
|
|
@ -158,20 +158,22 @@ public class Builder {
|
||||||
return myTableName;
|
return myTableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropIndex(String theVersion, String theIndexName) {
|
public BuilderCompleteTask dropIndex(String theVersion, String theIndexName) {
|
||||||
dropIndexOptional(false, theVersion, theIndexName);
|
BaseTask task = dropIndexOptional(false, theVersion, theIndexName);
|
||||||
|
return new BuilderCompleteTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropIndexStub(String theVersion, String theIndexName) {
|
public void dropIndexStub(String theVersion, String theIndexName) {
|
||||||
dropIndexOptional(true, theVersion, theIndexName);
|
dropIndexOptional(true, theVersion, theIndexName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropIndexOptional(boolean theDoNothing, String theVersion, String theIndexName) {
|
private DropIndexTask dropIndexOptional(boolean theDoNothing, String theVersion, String theIndexName) {
|
||||||
DropIndexTask task = new DropIndexTask(myRelease, theVersion);
|
DropIndexTask task = new DropIndexTask(myRelease, theVersion);
|
||||||
task.setIndexName(theIndexName);
|
task.setIndexName(theIndexName);
|
||||||
task.setTableName(myTableName);
|
task.setTableName(myTableName);
|
||||||
task.setDoNothing(theDoNothing);
|
task.setDoNothing(theDoNothing);
|
||||||
addTask(task);
|
addTask(task);
|
||||||
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renameIndex(String theVersion, String theOldIndexName, String theNewIndexName) {
|
public void renameIndex(String theVersion, String theOldIndexName, String theNewIndexName) {
|
||||||
|
@ -286,11 +288,12 @@ public class Builder {
|
||||||
withColumnsOptional(true, theColumnNames);
|
withColumnsOptional(true, theColumnNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void withColumns(String... theColumnNames) {
|
public BuilderCompleteTask withColumns(String... theColumnNames) {
|
||||||
withColumnsOptional(false, theColumnNames);
|
BaseTask task = withColumnsOptional(false, theColumnNames);
|
||||||
|
return new BuilderCompleteTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void withColumnsOptional(boolean theDoNothing, String... theColumnNames) {
|
private AddIndexTask withColumnsOptional(boolean theDoNothing, String... theColumnNames) {
|
||||||
AddIndexTask task = new AddIndexTask(myRelease, myVersion);
|
AddIndexTask task = new AddIndexTask(myRelease, myVersion);
|
||||||
task.setTableName(myTableName);
|
task.setTableName(myTableName);
|
||||||
task.setIndexName(myIndexName);
|
task.setIndexName(myIndexName);
|
||||||
|
@ -298,6 +301,7 @@ public class Builder {
|
||||||
task.setColumns(theColumnNames);
|
task.setColumns(theColumnNames);
|
||||||
task.setDoNothing(theDoNothing);
|
task.setDoNothing(theDoNothing);
|
||||||
addTask(task);
|
addTask(task);
|
||||||
|
return task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,6 +467,12 @@ public class Builder {
|
||||||
myTask.setFailureAllowed(true);
|
myTask.setFailureAllowed(true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BuilderCompleteTask doNothing() {
|
||||||
|
myTask.setDoNothing(true);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue