You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/04/20 13:28:18 UTC

[cloudstack] branch 4.11 updated: schema: fix create table only if not exists and remove drop table statements (#2582)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new b5abdd3  schema: fix create table only if not exists and remove drop table statements (#2582)
b5abdd3 is described below

commit b5abdd306e45d442b1224ecc68df621d56e79455
Author: ernjvr <er...@gmail.com>
AuthorDate: Fri Apr 20 15:28:12 2018 +0200

    schema: fix create table only if not exists and remove drop table statements (#2582)
---
 engine/schema/resources/META-INF/db/schema-41000to41100.sql | 5 ++---
 engine/schema/resources/META-INF/db/schema-452to460.sql     | 5 ++---
 engine/schema/resources/META-INF/db/schema-4930to41000.sql  | 8 ++++----
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/engine/schema/resources/META-INF/db/schema-41000to41100.sql b/engine/schema/resources/META-INF/db/schema-41000to41100.sql
index 4dc11d4..b3efce4 100644
--- a/engine/schema/resources/META-INF/db/schema-41000to41100.sql
+++ b/engine/schema/resources/META-INF/db/schema-41000to41100.sql
@@ -392,7 +392,7 @@ CREATE VIEW `cloud`.`volume_view` AS
         `cloud`.`domain` resource_tag_domain ON resource_tag_domain.id = resource_tags.domain_id;
 
 -- Extra Dhcp Options
-CREATE TABLE  IF NOT EXISTS `cloud`.`nic_extra_dhcp_options` (
+CREATE TABLE IF NOT EXISTS `cloud`.`nic_extra_dhcp_options` (
   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
   `uuid` varchar(255) UNIQUE,
   `nic_id` bigint unsigned NOT NULL COMMENT ' nic id where dhcp options are applied',
@@ -427,8 +427,7 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0  FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.1.0' AND guest_os_id not in (1,2,3,4,56,101,56,58,93,94,50,51,87,88,89,90,91,92,26,27,28,29,40,41,42,43,44,45,96,97,107,108,109,110,151,152,153);
 
 -- Add table to track primary storage in use for snapshots
-DROP TABLE IF EXISTS `cloud_usage`.`usage_snapshot_on_primary`;
-CREATE TABLE `cloud_usage`.`usage_snapshot_on_primary` (
+CREATE TABLE IF NOT EXISTS `cloud_usage`.`usage_snapshot_on_primary` (
   `id` bigint(20) unsigned NOT NULL,
   `zone_id` bigint(20) unsigned NOT NULL,
   `account_id` bigint(20) unsigned NOT NULL,
diff --git a/engine/schema/resources/META-INF/db/schema-452to460.sql b/engine/schema/resources/META-INF/db/schema-452to460.sql
index 1989b6c..ace22e4 100644
--- a/engine/schema/resources/META-INF/db/schema-452to460.sql
+++ b/engine/schema/resources/META-INF/db/schema-452to460.sql
@@ -385,8 +385,7 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'Netwo
 
 UPDATE IGNORE `cloud`.`configuration` SET `value`="PLAINTEXT" WHERE `name`="user.authenticators.exclude";
 
-DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`;
-CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
+CREATE TABLE IF NOT EXISTS `cloud`.`external_bigswitch_bcf_devices` (
   `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
   `uuid` varchar(255) UNIQUE,
   `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added',
@@ -405,7 +404,7 @@ CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` (
 
 UPDATE `cloud`.`host` SET `resource`='com.cloud.hypervisor.xenserver.resource.XenServer600Resource' WHERE `resource`='com.cloud.hypervisor.xenserver.resource.XenServer602Resource';
 
-CREATE TABLE `cloud`.`ldap_trust_map` (
+CREATE TABLE IF NOT EXISTS `cloud`.`ldap_trust_map` (
   `id` int unsigned NOT NULL AUTO_INCREMENT,
   `domain_id` bigint unsigned NOT NULL,
   `type` varchar(10) NOT NULL,
diff --git a/engine/schema/resources/META-INF/db/schema-4930to41000.sql b/engine/schema/resources/META-INF/db/schema-4930to41000.sql
index dbea77d..dc0cd6d 100644
--- a/engine/schema/resources/META-INF/db/schema-4930to41000.sql
+++ b/engine/schema/resources/META-INF/db/schema-4930to41000.sql
@@ -111,7 +111,7 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervi
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'KVM', 'default', 'CentOS 7.2', 274, now(), 0);
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'KVM', 'default', 'Other PV Virtio-SCSI (64-bit)', 275, now(), 0);
 
-CREATE TABLE `cloud`.`vlan_details` (
+CREATE TABLE IF NOT EXISTS `cloud`.`vlan_details` (
   `id` bigint unsigned NOT NULL auto_increment,
   `vlan_id` bigint unsigned NOT NULL COMMENT 'vlan id',
   `name` varchar(255) NOT NULL,
@@ -137,7 +137,7 @@ INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`,
 INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'createSnapshotFromVMSnapshot', 'ALLOW', 260) ON DUPLICATE KEY UPDATE rule=rule;
 
 -- Create table storage_pool_tags
-CREATE TABLE `cloud`.`storage_pool_tags` (
+CREATE TABLE IF NOT EXISTS `cloud`.`storage_pool_tags` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `pool_id` bigint(20) unsigned NOT NULL COMMENT "pool id",
   `tag` varchar(255) NOT NULL,
@@ -235,7 +235,7 @@ WHERE (o.cpu is null AND o.speed IS NULL AND o.ram_size IS NULL) AND
 -- CLOUDSTACK-9827: Storage tags stored in multiple places
 DROP VIEW IF EXISTS `cloud`.`storage_tag_view`;
 
-CREATE TABLE `cloud`.`guest_os_details` (
+CREATE TABLE IF NOT EXISTS `cloud`.`guest_os_details` (
   `id` bigint unsigned NOT NULL auto_increment,
   `guest_os_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id',
   `name` varchar(255) NOT NULL,
@@ -246,7 +246,7 @@ CREATE TABLE `cloud`.`guest_os_details` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 ALTER TABLE `user_ip_address` ADD COLUMN `rule_state` VARCHAR(32) COMMENT 'static  rule state while removing';
-CREATE TABLE `cloud`.`firewall_rules_dcidrs`(
+CREATE TABLE IF NOT EXISTS `cloud`.`firewall_rules_dcidrs`(
   `id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
   `firewall_rule_id` BIGINT(20) unsigned NOT NULL,
   `destination_cidr` VARCHAR(18) DEFAULT NULL,

-- 
To stop receiving notification emails like this one, please contact
rohit@apache.org.