fix migrate-data.ts postgres connection for unix socket
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user