#!/bin/bash
source $HOME/.gamerc

for set in 1 2 3 4 5 6 7 11 12 13 14 15 21 22 23 24 25 26 27 28 29 30; do
	echo GAMEDB${set} | colorize yellow black
	ssh GAMEDB${set} "psql -U postgres G1DB${set} -c \"copy (select account_name, account_id, player_id, platform, product_id, order_id, start_time, end_time, world_id::integer/1000 as set_id from order_mails_cache_bak where product_id in ('com.xlegend.grandfantasia.global_p2_m36_170','com.xlegend.grandfantasia.global_p2_m36_490','com.xlegend.grandfantasia.global_p1_m36_170','com.xlegend.grandfantasia.global_p1_m36_490','com.xlegend.grandfantasia.global_p201_m36_170','com.xlegend.grandfantasia.global_p201_m36_490') order by end_time desc) to '/tmp/g1en_epicpass_s${set}.csv' header csv;\""
done
