You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
$sql = "CREATE SERVER sqlite_server{$i} FOREIGN DATA WRAPPER sqlite_fdw OPTIONS (database '/home/isucon/webapp/tenant_db/{$i}.db');";
$sql = "IMPORT FOREIGN SCHEMA public FROM SERVER sqlite_server{$i} INTO sqlite{$i};";
// data
$sql = "INSERT INTO public.competition SELECT * from sqlite{$i}.competition;";
$sql = "INSERT INTO public.player SELECT * from sqlite{$i}.player;";
$sql = "INSERT INTO public.player_score SELECT * from sqlite{$i}.player_score;";
$sql = "INSERT INTO public.player_score SELECT id,tenant_id,player_id,competition_id,score,row_num,created_at,updated_at FROM (SELECT *,rank() OVER (partition by tenant_id,competition_id,player_id ORDER BY row_num DESC) as rank FROM sqlite{$i}.player_score) AS ranking WHERE rank = 1;";