mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 11667: drop primary keys in cloud_usage.usage_load_balancer_policy and cloud_usage.usage_port_forwarding
status 11667: resolved fixed Conflicts: server/src/com/cloud/user/AccountManagerImpl.java
This commit is contained in:
parent
d399c901c8
commit
eba6864965
@ -390,7 +390,7 @@ public class ResourceLimitManagerImpl implements ResourceLimitService, Manager{
|
|||||||
|
|
||||||
if (domainId != null) {
|
if (domainId != null) {
|
||||||
sc.setParameters("domainId", domainId);
|
sc.setParameters("domainId", domainId);
|
||||||
sc.setParameters("accountId", null);
|
sc.setParameters("accountId", (Object[])null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resourceType != null) {
|
if (resourceType != null) {
|
||||||
|
|||||||
@ -39,6 +39,25 @@ public class DbUpgradeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void dropPrimaryKeyIfExists(Connection conn, String tableName) {
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
try {
|
||||||
|
pstmt = conn.prepareStatement("ALTER TABLE " + tableName + " DROP PRIMARY KEY ");
|
||||||
|
pstmt.executeUpdate();
|
||||||
|
s_logger.debug("Primary key is dropped successfully from the table " + tableName);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// do nothing here
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (pstmt != null) {
|
||||||
|
pstmt.close();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void dropTableColumnsIfExist(Connection conn, String tableName, List<String> columns) {
|
public static void dropTableColumnsIfExist(Connection conn, String tableName, List<String> columns) {
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -89,5 +89,8 @@ public class Upgrade2212to2213 implements DbUpgrade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// drop primary keys
|
||||||
|
DbUpgradeUtils.dropPrimaryKeyIfExists(conn, "cloud_usage.usage_load_balancer_policy");
|
||||||
|
DbUpgradeUtils.dropPrimaryKeyIfExists(conn, "cloud_usage.usage_port_forwarding");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -244,7 +244,6 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AccountVO getSystemAccount() {
|
public AccountVO getSystemAccount() {
|
||||||
if (_systemAccount == null) {
|
if (_systemAccount == null) {
|
||||||
_systemAccount = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
_systemAccount = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
|
||||||
|
|||||||
@ -178,8 +178,7 @@ CREATE TABLE `cloud_usage`.`usage_load_balancer_policy` (
|
|||||||
`account_id` bigint unsigned NOT NULL,
|
`account_id` bigint unsigned NOT NULL,
|
||||||
`domain_id` bigint unsigned NOT NULL,
|
`domain_id` bigint unsigned NOT NULL,
|
||||||
`created` DATETIME NOT NULL,
|
`created` DATETIME NOT NULL,
|
||||||
`deleted` DATETIME NULL,
|
`deleted` DATETIME NULL
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
ALTER TABLE `cloud_usage`.`usage_load_balancer_policy` ADD INDEX `i_usage_load_balancer_policy__account_id`(`account_id`);
|
ALTER TABLE `cloud_usage`.`usage_load_balancer_policy` ADD INDEX `i_usage_load_balancer_policy__account_id`(`account_id`);
|
||||||
@ -210,8 +209,7 @@ CREATE TABLE `cloud_usage`.`usage_port_forwarding` (
|
|||||||
`account_id` bigint unsigned NOT NULL,
|
`account_id` bigint unsigned NOT NULL,
|
||||||
`domain_id` bigint unsigned NOT NULL,
|
`domain_id` bigint unsigned NOT NULL,
|
||||||
`created` DATETIME NOT NULL,
|
`created` DATETIME NOT NULL,
|
||||||
`deleted` DATETIME NULL,
|
`deleted` DATETIME NULL
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
ALTER TABLE `cloud_usage`.`usage_port_forwarding` ADD INDEX `i_usage_port_forwarding__account_id`(`account_id`);
|
ALTER TABLE `cloud_usage`.`usage_port_forwarding` ADD INDEX `i_usage_port_forwarding__account_id`(`account_id`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user