Home | History | Annotate | Download | only in migrations
      1 INDEXES = (
      2     ('acl_groups_hosts', 'host_id'),
      3     ('acl_groups_hosts', 'acl_group_id'),
      4     ('acl_groups_users', 'user_id'),
      5     ('acl_groups_users', 'acl_group_id'),
      6 )
      7 
      8 def get_index_name(table, field):
      9     return table + '_' + field
     10 
     11 
     12 def migrate_up(manager):
     13     for table, field in INDEXES:
     14         manager.execute('CREATE INDEX %s ON %s (%s)' %
     15                         (get_index_name(table, field), table, field))
     16 
     17 
     18 def migrate_down(manager):
     19     for table, field in INDEXES:
     20         manager.execute('DROP INDEX %s ON %s' %
     21                         (get_index_name(table, field), table))
     22