Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,49 @@

DELETE FROM `cloud`.`configuration` WHERE name='snapshot.backup.rightafter';
-- CLOUDSTACK-9914: Alter quota_tariff to support currency values up to 5 decimal places
ALTER TABLE `cloud_usage`.`quota_tariff` MODIFY `currency_value` DECIMAL(15,5) not null
ALTER TABLE `cloud_usage`.`quota_tariff` MODIFY `currency_value` DECIMAL(15,5) not null;

DROP VIEW IF EXISTS `cloud`.`user_view`;
CREATE VIEW `cloud`.`user_view` AS
select
user.id,
user.uuid,
user.username,
user.password,
user.firstname,
user.lastname,
user.email,
user.state,
user.api_key,
user.secret_key,
user.created,
user.removed,
user.timezone,
user.registration_token,
user.is_registered,
user.incorrect_login_attempts,
user.source,
user.default,
account.id account_id,
account.uuid account_uuid,
account.account_name account_name,
account.type account_type,
account.role_id account_role_id,
domain.id domain_id,
domain.uuid domain_uuid,
domain.name domain_name,
domain.path domain_path,
async_job.id job_id,
async_job.uuid job_uuid,
async_job.job_status job_status,
async_job.account_id job_account_id
from
`cloud`.`user`
inner join
`cloud`.`account` ON user.account_id = account.id
inner join
`cloud`.`domain` ON account.domain_id = domain.id
left join
`cloud`.`async_job` ON async_job.instance_id = user.id
and async_job.instance_type = 'User'
and async_job.job_status = 0;
21 changes: 21 additions & 0 deletions engine/schema/resources/META-INF/db/schema-41000to41100.sql
Original file line number Diff line number Diff line change
Expand Up @@ -546,3 +546,24 @@ ALTER TABLE cloud.ldap_trust_map ADD COLUMN account_id BIGINT(20) DEFAULT 0;
ALTER TABLE cloud.ldap_trust_map DROP FOREIGN KEY fk_ldap_trust_map__domain_id;
DROP INDEX uk_ldap_trust_map__domain_id ON cloud.ldap_trust_map;
CREATE UNIQUE INDEX uk_ldap_trust_map__bind_location ON ldap_trust_map (domain_id, account_id);

CREATE TABLE IF NOT EXISTS `cloud`.`netscaler_servicepackages` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(255) UNIQUE,
`name` varchar(255) UNIQUE COMMENT 'name of the service package',
`description` varchar(255) COMMENT 'description of the service package',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `cloud`.`external_netscaler_controlcenter` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(255) UNIQUE,
`username` varchar(255) COMMENT 'username of the NCC',
`password` varchar(255) COMMENT 'password of NCC',
`ncc_ip` varchar(255) COMMENT 'IP of NCC Manager',
`num_retries` bigint unsigned NOT NULL default 2 COMMENT 'Number of retries in ncc for command failure',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that name field already exists in sslcerts table ?
If yes, upgrade will fail here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assumption is it won't exist in before 4.11.0.0 release. Users of 4.9.3.0 or earlier will get this change when they upgrade to 4.11.0.0 but 4.10.0.0 users won't. See the dev/user ML for the discussion/proposal. But I see what you mean, the query is not idempotent which perhaps @ernjvr and @borisstoyanov may help improve.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd thanks for your explanation.
LGTM now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if pull request #2449 gets approved and merged, we can make this add column statement idempotent afterwards

ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package';
45 changes: 0 additions & 45 deletions engine/schema/resources/META-INF/db/schema-4930to41000-cleanup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,3 @@
DELETE FROM `cloud`.`configuration` WHERE name='consoleproxy.loadscan.interval';

DELETE FROM `cloud`.`host_details` where name = 'vmName' and value in (select name from `cloud`.`vm_instance` where state = 'Expunging' and hypervisor_type ='BareMetal');

DROP VIEW IF EXISTS `cloud`.`user_view`;
CREATE VIEW `cloud`.`user_view` AS
select
user.id,
user.uuid,
user.username,
user.password,
user.firstname,
user.lastname,
user.email,
user.state,
user.api_key,
user.secret_key,
user.created,
user.removed,
user.timezone,
user.registration_token,
user.is_registered,
user.incorrect_login_attempts,
user.source,
user.default,
account.id account_id,
account.uuid account_uuid,
account.account_name account_name,
account.type account_type,
account.role_id account_role_id,
domain.id domain_id,
domain.uuid domain_uuid,
domain.name domain_name,
domain.path domain_path,
async_job.id job_id,
async_job.uuid job_uuid,
async_job.job_status job_status,
async_job.account_id job_account_id
from
`cloud`.`user`
inner join
`cloud`.`account` ON user.account_id = account.id
inner join
`cloud`.`domain` ON account.domain_id = domain.id
left join
`cloud`.`async_job` ON async_job.instance_id = user.id
and async_job.instance_type = 'User'
and async_job.job_status = 0;
23 changes: 0 additions & 23 deletions engine/schema/resources/META-INF/db/schema-4930to41000.sql
Original file line number Diff line number Diff line change
Expand Up @@ -255,26 +255,3 @@ CREATE TABLE `cloud`.`firewall_rules_dcidrs`(
KEY `fk_firewall_dcidrs_firewall_rules` (`firewall_rule_id`),
CONSTRAINT `fk_firewall_dcidrs_firewall_rules` FOREIGN KEY (`firewall_rule_id`) REFERENCES `firewall_rules` (`id`) ON DELETE CASCADE
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `cloud`.`netscaler_servicepackages`;
CREATE TABLE `cloud`.`netscaler_servicepackages` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(255) UNIQUE,
`name` varchar(255) UNIQUE COMMENT 'name of the service package',
`description` varchar(255) COMMENT 'description of the service package',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `cloud`.`external_netscaler_controlcenter`;
CREATE TABLE `cloud`.`external_netscaler_controlcenter` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(255) UNIQUE,
`username` varchar(255) COMMENT 'username of the NCC',
`password` varchar(255) COMMENT 'password of NCC',
`ncc_ip` varchar(255) COMMENT 'IP of NCC Manager',
`num_retries` bigint unsigned NOT NULL default 2 COMMENT 'Number of retries in ncc for command failure',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate';
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package';