tables = [ "game_sugar_record", "game_sugar_user", "game_wheel_round_bet", "game_wheel_user", "tt_announcement_read", "tt_attendance_record", "tt_bonus_receive_record", "tt_box_records", "tt_commission_record", "tt_delivery_record", "tt_exponent_user", "tt_exponent_user_box", "tt_fight", "tt_fight_user", "tt_notice", "tt_order", "tt_promotion_record", "tt_recharge_record", "tt_red_packet", "tt_red_packet_record", "tt_roll", "tt_roll_user", "tt_task_center_user", "tt_time_roll_user", "tt_upgrade_record", "tt_user_blend_ercash", "tt_welfare_record", "tt_recharge_record", "game_sugar_win", "game_wheel_round", "tt_recharge_card", ] def clear_data(): for table in tables: print( f"""CREATE TABLE {table}_new LIKE {table}; RENAME TABLE {table} TO {table}_old, {table}_new TO {table};""" ) def clear(): for table in tables: print(f"DROP TABLE IF EXISTS {table}_old;") print(f"DROP TABLE IF EXISTS {table}_new;") # clear() clear_data()