diff --git a/scripts/migrate-data.ts b/scripts/migrate-data.ts index dd14217..a612016 100644 --- a/scripts/migrate-data.ts +++ b/scripts/migrate-data.ts @@ -30,7 +30,15 @@ const maria = await mysql.createConnection({ timezone: "+00:00", }); -const pg = postgres(PG_URL); +const pgUrl = new URL(PG_URL); +const socketHost = pgUrl.searchParams.get("host"); +const pg = postgres({ + host: socketHost ?? pgUrl.hostname, + port: Number(pgUrl.port) || 5432, + database: pgUrl.pathname.slice(1), + username: pgUrl.username, + password: pgUrl.password, +}); // Order: rounds → round_users → movies → votes → round_history (FK constraint order)