• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1UP_SQL = """\
2BEGIN;
3
4SET storage_engine = InnoDB;
5
6CREATE TABLE `planner_plan_host_labels` (
7    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
8    `plan_id` integer NOT NULL,
9    `label_id` integer NOT NULL
10)
11;
12ALTER TABLE `planner_plan_host_labels` ADD CONSTRAINT plan_host_labels_plan_id_fk FOREIGN KEY (`plan_id`) REFERENCES `planner_plans` (`id`);
13ALTER TABLE `planner_plan_host_labels` ADD CONSTRAINT plan_host_labels_label_id_fk FOREIGN KEY (`label_id`) REFERENCES `afe_labels` (`id`);
14
15
16ALTER TABLE `planner_tests` ADD COLUMN `alias` varchar(255) NOT NULL;
17ALTER TABLE `planner_tests` ADD CONSTRAINT `tests_plan_id_alias_unique` UNIQUE KEY (`plan_id`, `alias`);
18
19
20ALTER TABLE `planner_tests` ADD COLUMN `estimated_runtime` int NOT NULL;
21
22
23ALTER TABLE `planner_test_runs` ADD COLUMN `host_id` int NOT NULL;
24ALTER TABLE `planner_test_runs` ADD CONSTRAINT `test_runs_host_id_fk` FOREIGN KEY (`host_id`) REFERENCES `planner_hosts` (`id`);
25
26COMMIT;
27"""
28
29DOWN_SQL = """\
30ALTER TABLE `planner_tests` DROP KEY `tests_plan_id_alias_unique`;
31ALTER TABLE `planner_tests` DROP COLUMN `alias`;
32ALTER TABLE `planner_tests` DROP COLUMN `estimated_runtime`;
33ALTER TABLE `planner_test_runs` DROP FOREIGN KEY `test_runs_host_id_fk`;
34ALTER TABLE `planner_test_runs` DROP COLUMN `host_id`;
35DROP TABLE IF EXISTS `planner_plan_host_labels`;
36"""
37