def migrate_orders(answer): if answer != oath: return from migration.ordersm import MigrateOrders mo = MigrateOrders() mo.migrate_old_orders()
if __name__ == '__main__': if len(sys.argv) != 2: print 'Incorrect usage. Needs an argument. Valid options for argument are' print 'create-product-map -- creates product map' print 'cleanup -- cleanup' print 'migrate-users -- migrates users' print 'migrate-orders -- migrates orders' print 'migrate-all --- cleansup, migrates users, migrates orders' print 'clean-sessions --- deletes all sessions' else: action = sys.argv[1] if action == 'create-product-map': from migration.ordersm import MigrateOrders mo = MigrateOrders() mo.create_product_map() else: print 'This is going to delete data. Make sure you have backedup what you need.' print 'This is going to delete orders, order items, addresses, users, profiles,' print 'delivery info, gift info, shipping details, subscription details' while True: print 'Make the commitment to proceed: ', answer = sys.stdin.readline().strip() if answer == oath: if action == 'migrate-all' or action == 'cleanup': # Step 1: Clean up data which we are going to migrate clean_orders(answer) clean_users(answer) if action == 'migrate-all' or action == 'migrate-users': # Step 2: Migrate users