avoid useless EO/VO relationship
-CREATE TABLE `zstack`.`CdpBackupStorageVO` (
+CREATE TABLE IF NOT EXISTS `zstack`.`CdpBackupStorageVO` (
`uuid` varchar(32) NOT NULL UNIQUE,
`hostname` varchar(255) NOT NULL UNIQUE,
`username` varchar(255) NOT NULL,
@@ -7,11 +7,10 @@ CREATE TABLE `zstack`.`CdpBackupStorageVO` (
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE `zstack`.`CdpPolicyEO` (
+CREATE TABLE IF NOT EXISTS `zstack`.`CdpPolicyEO` (
`uuid` varchar(32) NOT NULL UNIQUE,
`name` varchar(255) DEFAULT NULL,
`description` varchar(2048) DEFAULT NULL,
- `vmInstanceUuid` varchar(32) DEFAULT NULL UNIQUE,
`retentionTimePerDay` int unsigned NOT NULL,
`incrementalPointPerMinute` int unsigned NOT NULL,
`recoveryPointPerSecond` int unsigned NOT NULL,
@@ -19,32 +18,28 @@ CREATE TABLE `zstack`.`CdpPolicyEO` (
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE `zstack`.`CdpPolicyRefVO` (
+CREATE TABLE IF NOT EXISTS `zstack`.`CdpPolicyRefVO` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
`uuid` varchar(32) NOT NULL,
`vmInstanceUuid` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE VIEW `zstack`.`CdpPolicyVO` AS SELECT uuid, name, description, vmInstanceUuid, retentionTimePerDay, incrementalPointPerMinute, recoveryPointPerSecond FROM `zstack`.`CdpPolicyEO` WHERE deleted IS NULL;
+DROP VIEW IF EXISTS `zstack`.`CdpPolicyVO`;
+CREATE VIEW `zstack`.`CdpPolicyVO` AS SELECT uuid, name, description, retentionTimePerDay, incrementalPointPerMinute, recoveryPointPerSecond FROM `zstack`.`CdpPolicyEO` WHERE deleted IS NULL;
-CREATE TABLE `zstack`.`CdpTaskEO` (
- `uuid` varchar(32) NOT NULL UNIQUE,
- `name` varchar(255) DEFAULT NULL,
- `description` varchar(2048) DEFAULT NULL,
+CREATE TABLE IF NOT EXISTS `zstack`.`CdpTaskVO` (
`vmInstanceUuid` varchar(32) NOT NULL,
+ `backupStorageUuid` varchar(32) NOT NULL,
`retentionTimePerDay` int unsigned DEFAULT NULL,
`incrementalPointPerMinute` int unsigned DEFAULT NULL,
`recoveryPointPerSecond` int unsigned DEFAULT NULL,
- `deleted` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`uuid`)
+ PRIMARY KEY (`vmInstanceUuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE `zstack`.`CdpTaskRefVO` (
+CREATE TABLE IF NOT EXISTS `zstack`.`CdpTaskRefVO` (
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
`uuid` varchar(32) NOT NULL,
`volumeUuid` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE VIEW `zstack`.`CdpTaskVO` AS SELECT uuid, name, description, vmInstanceUuid, retentionTimePerDay, incrementalPointPerMinute, recoveryPointPerSecond FROM `zstack`.`CdpTaskEO` WHERE deleted IS NULL;
