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