salix/db/versions/.archive/10175-bluePaniculata/00-firstScript.sql

41 lines
1.1 KiB
MySQL
Raw Normal View History

CREATE TABLE `vn`.`mdbBranch` (
`name` VARCHAR(255),
PRIMARY KEY(`name`)
);
CREATE TABLE `vn`.`mdbVersion` (
`app` VARCHAR(255) NOT NULL,
`branchFk` VARCHAR(255) NOT NULL,
`version` INT,
CONSTRAINT `mdbVersion_branchFk` FOREIGN KEY (`branchFk`) REFERENCES `vn`.`mdbBranch` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES('MdbVersion', '*', '*', 'ALLOW', 'ROLE', 'developer');
INSERT INTO `vn`.`mdbBranch` (`name`)
VALUES
('test'),
('master');
INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`)
SELECT programa, 'master', version
FROM vn2008.versiones;
INSERT INTO `vn`.`mdbVersion` (`app`, `branchFk`, `version`)
SELECT programa, 'test', version
FROM vn2008.versiones;
RENAME TABLE vn2008.versiones TO vn2008.versiones__;
CREATE OR REPLACE
ALGORITHM = UNDEFINED VIEW `vn2008`.`versiones` AS
SELECT
`m`.`app` AS `programa`,
`m`.`version` AS `version`,
0 AS `critical`
FROM
`vn`.`mdbVersion` `m`
WHERE
(`m`.`branchFk` = 'master');