1 UP_SQL = """ 2 CREATE TABLE planner_additional_parameters ( 3 id INT PRIMARY KEY AUTO_INCREMENT, 4 plan_id INT NOT NULL, 5 hostname_regex VARCHAR(255) NOT NULL, 6 param_type VARCHAR(32) NOT NULL, 7 application_order INT NOT NULL 8 ) ENGINE = InnoDB; 9 10 ALTER TABLE planner_additional_parameters 11 ADD CONSTRAINT planner_additional_parameters_plan_ibfk 12 FOREIGN KEY (plan_id) REFERENCES planner_plans (id); 13 14 ALTER TABLE planner_additional_parameters 15 ADD CONSTRAINT planner_additional_parameters_unique 16 UNIQUE KEY (plan_id, hostname_regex, param_type); 17 18 19 CREATE TABLE planner_additional_parameter_values ( 20 id INT PRIMARY KEY AUTO_INCREMENT, 21 additional_parameter_id INT NOT NULL, 22 `key` VARCHAR(255) NOT NULL, 23 value VARCHAR(255) NOT NULL 24 ) ENGINE = InnoDB; 25 26 ALTER TABLE planner_additional_parameter_values 27 ADD CONSTRAINT planner_additional_parameter_values_additional_parameter_ibfk 28 FOREIGN KEY (additional_parameter_id) 29 REFERENCES planner_additional_parameters (id); 30 31 ALTER TABLE planner_additional_parameter_values 32 ADD CONSTRAINT planner_additional_parameter_values_unique 33 UNIQUE KEY (additional_parameter_id, `key`); 34 """ 35 36 DOWN_SQL = """ 37 ALTER TABLE planner_additional_parameter_values 38 DROP FOREIGN KEY planner_additional_parameter_values_additional_parameter_ibfk; 39 40 DROP TABLE planner_additional_parameter_values; 41 42 43 ALTER TABLE planner_additional_parameters 44 DROP FOREIGN KEY planner_additional_parameters_plan_ibfk; 45 46 DROP TABLE planner_additional_parameters; 47 """ 48