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