mirror of https://github.com/apache/cloudstack.git
bug 10265: 226 to 227 db upgrade - remove unique key constraint for "network_offerings.name" field (if exists)
status 10265: resolved fixed
This commit is contained in:
parent
6744645ba5
commit
f7814df488
|
|
@ -23,6 +23,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -90,6 +91,7 @@ public class Upgrade226to227 implements DbUpgrade {
|
|||
}
|
||||
|
||||
updateDomainLevelNetworks(conn);
|
||||
dropKeysIfExist(conn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -133,4 +135,20 @@ public class Upgrade226to227 implements DbUpgrade {
|
|||
}
|
||||
}
|
||||
|
||||
private void dropKeysIfExist(Connection conn) {
|
||||
HashMap<String, List<String>> indexes = new HashMap<String, List<String>>();
|
||||
|
||||
// domain router table
|
||||
List<String> keys = new ArrayList<String>();
|
||||
keys.add("unique_name");
|
||||
indexes.put("network_offerings", keys);
|
||||
|
||||
s_logger.debug("Dropping keys that don't exist in 2.2.7 version of the DB...");
|
||||
|
||||
// drop indexes now
|
||||
for (String tableName : indexes.keySet()) {
|
||||
DbUpgradeUtils.dropKeysIfExist(conn, tableName, indexes.get(tableName), false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue