1import common 2from autotest_lib.database import db_utils 3 4 5ORIG_NAMES = ( 6 'aborted_host_queue_entries', 7 'acl_groups', 8 'acl_groups_hosts', 9 'acl_groups_users', 10 'atomic_groups', 11 'autotests', 12 'autotests_dependency_labels', 13 'host_attributes', 14 'host_queue_entries', 15 'hosts', 16 'hosts_labels', 17 'ineligible_host_queues', 18 'jobs', 19 'jobs_dependency_labels', 20 'labels', 21 'profilers', 22 'recurring_run', 23 'special_tasks', 24 'users', 25 ) 26 27RENAMES_UP = dict((name, 'afe_' + name) for name in ORIG_NAMES) 28 29RENAMES_DOWN = dict((value, key) for key, value in RENAMES_UP.iteritems()) 30 31 32def migrate_up(manager): 33 db_utils.rename(manager, RENAMES_UP) 34 35 36def migrate_down(manager): 37 db_utils.rename(manager, RENAMES_DOWN) 38