@Override
public void execute(Context context) throws SQLException {
MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct pm.project_id, s.component_uuid from project_measures pm inner join snapshots s on s.id=pm.snapshot_id where pm.component_uuid is null");
- massUpdate.update("UPDATE project_measures SET component_uuid=? WHERE project_id=? and component_uuid is null");
+ massUpdate.select("select distinct pm.snapshot_id, s.component_uuid from project_measures pm inner join snapshots s on s.id=pm.snapshot_id where pm.component_uuid is null");
+ massUpdate.update("UPDATE project_measures SET component_uuid=? WHERE snapshot_id=? and component_uuid is null");
massUpdate.rowPluralName("measures");
massUpdate.execute(this::handle);
}
public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long projectId = row.getLong(1);
-
+ long snapshotId = row.getLong(1);
String componentUuid = row.getString(2);
+
update.setString(1, componentUuid);
- update.setLong(2, projectId);
+ update.setLong(2, snapshotId);
return true;
}