1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
INDEXES = (
('ineligible_host_queues', 'job_id'),
('ineligible_host_queues', 'host_id'),
('host_queue_entries', 'job_id'),
('host_queue_entries', 'host_id'),
('host_queue_entries', 'meta_host'),
('hosts_labels', 'label_id'),
)
def get_index_name(table, field):
return table + '_' + field
def migrate_up(manager):
for table, field in INDEXES:
manager.execute('CREATE INDEX %s ON %s (%s)' %
(get_index_name(table, field), table, field))
def migrate_down(manager):
for table, field in INDEXES:
manager.execute('DROP INDEX %s ON %s' %
(get_index_name(table, field), table))
|