1CREATE_TABLES_SQL = """ 2CREATE TABLE `test_labels` ( 3 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, 4 `name` varchar(80) NOT NULL, 5 `description` longtext NOT NULL 6); 7 8CREATE TABLE `test_labels_tests` ( 9 `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, 10 `testlabel_id` integer NOT NULL REFERENCES `test_labels` (`id`), 11 `test_id` integer NOT NULL REFERENCES `tests` (`test_idx`), 12 UNIQUE (`testlabel_id`, `test_id`) 13); 14""" 15 16DROP_TABLES_SQL = """ 17DROP TABLE IF EXISTS `test_labels`; 18DROP TABLE IF EXISTS `test_labels_tests`; 19""" 20 21 22def migrate_up(manager): 23 manager.execute_script(CREATE_TABLES_SQL) 24 25 26def migrate_down(manager): 27 manager.execute_script(DROP_TABLES_SQL) 28