Home | History | Annotate | Download | only in migrations
      1 def migrate_up(manager):
      2     manager.execute_script(CREATE_TABLE)
      3 
      4 def migrate_down(manager):
      5     manager.execute_script(DROP_TABLE)
      6 
      7 CREATE_TABLE = """\
      8 CREATE TABLE `recurring_run` (
      9     `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
     10     `job_id` integer NOT NULL REFERENCES `jobs` (`id`),
     11     `owner_id` integer NOT NULL REFERENCES `users` (`id`),
     12     `start_date` datetime NOT NULL,
     13     `loop_period` integer NOT NULL,
     14     `loop_count` integer NOT NULL
     15 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
     16 CREATE INDEX recurring_run_job_id ON `recurring_run` (`job_id`);
     17 CREATE INDEX recurring_run_owner_id ON `recurring_run` (`owner_id`);
     18 """
     19 
     20 DROP_TABLE = """\
     21 DROP INDEX recurring_run_job_id ON `recurring_run`;
     22 DROP TABLE IF EXISTS `recurring_run`;
     23 """
     24