Make PID column name configurable in migrator
This commit is contained in:
parent
2d7c808326
commit
0e34f16890
|
@ -50,6 +50,7 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
|
|||
protected static final Logger ourLog = LoggerFactory.getLogger(BaseColumnCalculatorTask.class);
|
||||
private int myBatchSize = 10000;
|
||||
private ThreadPoolExecutor myExecutor;
|
||||
private String myPidColumnName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -160,6 +161,10 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
|
|||
rejectedExecutionHandler);
|
||||
}
|
||||
|
||||
public void setPidColumnName(String thePidColumnName) {
|
||||
myPidColumnName = thePidColumnName;
|
||||
}
|
||||
|
||||
private Future<?> updateRows(List<Map<String, Object>> theRows) {
|
||||
Runnable task = () -> {
|
||||
StopWatch sw = new StopWatch();
|
||||
|
@ -193,8 +198,8 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
|
|||
sqlBuilder.append(nextNewValueEntry.getKey()).append(" = ?");
|
||||
arguments.add(nextNewValueEntry.getValue());
|
||||
}
|
||||
sqlBuilder.append(" WHERE SP_ID = ?");
|
||||
arguments.add((Number) nextRow.get("SP_ID"));
|
||||
sqlBuilder.append(" WHERE " + myPidColumnName + " = ?");
|
||||
arguments.add((Number) nextRow.get(myPidColumnName));
|
||||
|
||||
// Apply update SQL
|
||||
newJdbcTemplate().update(sqlBuilder.toString(), arguments.toArray());
|
||||
|
|
|
@ -46,6 +46,7 @@ public class CalculateHashesTask extends BaseColumnCalculatorTask {
|
|||
public CalculateHashesTask(VersionEnum theRelease, String theVersion) {
|
||||
super(theRelease, theVersion);
|
||||
setDescription("Calculate resource search parameter index hashes");
|
||||
setPidColumnName("SP_ID");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ public class CalculateOrdinalDatesTask extends BaseColumnCalculatorTask {
|
|||
super(theRelease, theVersion);
|
||||
setDescription("Calculate SP_LOW_VALUE_DATE_ORDINAL and SP_HIGH_VALUE_DATE_ORDINAL based on existing SP_VALUE_LOW and SP_VALUE_HIGH date values in Date Search Params");
|
||||
setWhereClause("(SP_VALUE_LOW_DATE_ORDINAL IS NULL AND SP_VALUE_LOW IS NOT NULL) OR (SP_VALUE_HIGH_DATE_ORDINAL IS NULL AND SP_VALUE_HIGH IS NOT NULL)");
|
||||
setPidColumnName("SP_ID");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue