1UP_SQL = """ 2CREATE 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 10ALTER TABLE planner_additional_parameters 11ADD CONSTRAINT planner_additional_parameters_plan_ibfk 12FOREIGN KEY (plan_id) REFERENCES planner_plans (id); 13 14ALTER TABLE planner_additional_parameters 15ADD CONSTRAINT planner_additional_parameters_unique 16UNIQUE KEY (plan_id, hostname_regex, param_type); 17 18 19CREATE 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 26ALTER TABLE planner_additional_parameter_values 27ADD CONSTRAINT planner_additional_parameter_values_additional_parameter_ibfk 28FOREIGN KEY (additional_parameter_id) 29 REFERENCES planner_additional_parameters (id); 30 31ALTER TABLE planner_additional_parameter_values 32ADD CONSTRAINT planner_additional_parameter_values_unique 33UNIQUE KEY (additional_parameter_id, `key`); 34""" 35 36DOWN_SQL = """ 37ALTER TABLE planner_additional_parameter_values 38DROP FOREIGN KEY planner_additional_parameter_values_additional_parameter_ibfk; 39 40DROP TABLE planner_additional_parameter_values; 41 42 43ALTER TABLE planner_additional_parameters 44DROP FOREIGN KEY planner_additional_parameters_plan_ibfk; 45 46DROP TABLE planner_additional_parameters; 47""" 48