mirror of https://github.com/apache/cloudstack.git
Bug 13454: Remove foriegn keys in ssh_keypairs table and again with correct constraint name
Status 13454: resolved fixed Reviewed-By: Nitin Conflicts: server/src/com/cloud/upgrade/dao/Upgrade2213to2214.java
This commit is contained in:
parent
6d2e75d057
commit
b0aaf75c3b
|
|
@ -143,6 +143,29 @@ public class Upgrade2213to2214 implements DbUpgrade {
|
|||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to insert index for removed column in async_job", e);
|
||||
}
|
||||
|
||||
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, true);
|
||||
|
||||
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();
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to execute ssh_keypairs table update for adding account_id foreign key", e);
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement pstmt; pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`ssh_keypairs` ADD CONSTRAINT `fk_ssh_keypairs__domain_id` FOREIGN KEY `fk_ssh_keypairs__domain_id` (`domain_id`) REFERENCES `domain` (`id`) ON DELETE CASCADE");
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable to execute ssh_keypairs table update for adding domain_id foreign key", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue