1def migrate_up(manager):
2    manager.execute_script(CREATE_TABLE)
3
4def migrate_down(manager):
5    manager.execute_script(DROP_TABLE)
6
7CREATE_TABLE = """\
8CREATE 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;
16CREATE INDEX recurring_run_job_id ON `recurring_run` (`job_id`);
17CREATE INDEX recurring_run_owner_id ON `recurring_run` (`owner_id`);
18"""
19
20DROP_TABLE = """\
21DROP INDEX recurring_run_job_id ON `recurring_run`;
22DROP TABLE IF EXISTS `recurring_run`;
23"""
24