Home | History | Annotate | Download | only in migrations
      1 CREATE_TABLES_SQL = """
      2 CREATE 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 
      8 CREATE 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 
     16 DROP_TABLES_SQL = """
     17 DROP TABLE IF EXISTS `test_labels`;
     18 DROP TABLE IF EXISTS `test_labels_tests`;
     19 """
     20 
     21 
     22 def migrate_up(manager):
     23     manager.execute_script(CREATE_TABLES_SQL)
     24 
     25 
     26 def migrate_down(manager):
     27     manager.execute_script(DROP_TABLES_SQL)
     28