Skip to content

Commit

Permalink
Revert "LPD-27779 Update only rows matching ctCollectionId"
Browse files Browse the repository at this point in the history
This reverts commit 5a3a754.
  • Loading branch information
marianoalvarosaiz authored and brianchandotcom committed Aug 28, 2024
1 parent 60e87e9 commit 4a5be03
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ protected void doUpgrade() throws Exception {
connection.prepareStatement(
StringBundler.concat(
"select DDMStructureVersion.structureVersionId, ",
"DDMStorageLink.ctCollectionId, ",
"DDMStorageLink.storageLinkId from DDMStorageLink ",
"inner join DDMStructure on DDMStructure.structureId ",
"= DDMStorageLink.structureVersionId inner join ",
Expand All @@ -46,13 +45,12 @@ protected void doUpgrade() throws Exception {
AutoBatchPreparedStatementUtil.autoBatch(
connection,
"update DDMStorageLink set structureVersionId = ? where " +
"ctCollectionId = ? and storageLinkId = ?");
"storageLinkId = ?");
ResultSet resultSet = selectPreparedStatement.executeQuery()) {

while (resultSet.next()) {
updatePreparedStatement.setLong(1, resultSet.getLong(1));
updatePreparedStatement.setLong(2, resultSet.getLong(2));
updatePreparedStatement.setLong(3, resultSet.getLong(3));

updatePreparedStatement.addBatch();
}
Expand All @@ -64,7 +62,6 @@ protected void doUpgrade() throws Exception {
connection.prepareStatement(
StringBundler.concat(
"select DDMStructureVersion.structureId, ",
"DDMStorageLink.ctCollectionId, ",
"DDMStorageLink.storageLinkId from DDMStorageLink ",
"inner join DDMStructureVersion on ",
"DDMStructureVersion.structureVersionId = ",
Expand All @@ -74,13 +71,12 @@ protected void doUpgrade() throws Exception {
AutoBatchPreparedStatementUtil.autoBatch(
connection,
"update DDMStorageLink set structureId = ? where " +
"ctCollectionId = ? and storageLinkId = ?");
"storageLinkId = ?");
ResultSet resultSet = selectPreparedStatement.executeQuery()) {

while (resultSet.next()) {
updatePreparedStatement.setLong(1, resultSet.getLong(1));
updatePreparedStatement.setLong(2, resultSet.getLong(2));
updatePreparedStatement.setLong(3, resultSet.getLong(3));

updatePreparedStatement.addBatch();
}
Expand Down

0 comments on commit 4a5be03

Please sign in to comment.