Bug 13454: Drop both foreign keys, indexes of ssh_keypairs and add again

Status 13454: resolved fixed
Reviewed-By: Nitin
This commit is contained in:
kishan 2012-02-08 15:24:40 +05:30
parent 31fe8bd815
commit 034b5890e6

View File

@ -151,6 +151,13 @@ public class Upgrade2213to2214 implements DbUpgrade {
keys.add("fk_ssh_keypairs__domain_id");
DbUpgradeUtils.dropKeysIfExist(conn, "ssh_keypairs", keys, true);
keys = new ArrayList<String>();
keys.add("fk_ssh_keypair__account_id");
keys.add("fk_ssh_keypair__domain_id");
keys.add("fk_ssh_keypairs__account_id");
keys.add("fk_ssh_keypairs__domain_id");
DbUpgradeUtils.dropKeysIfExist(conn, "ssh_keypairs", keys, false);
try {
PreparedStatement pstmt; pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`ssh_keypairs` ADD CONSTRAINT `fk_ssh_keypairs__account_id` FOREIGN KEY `fk_ssh_keypairs__account_id` (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE");
pstmt.executeUpdate();