Collects Pararius rent/buy listings into Postgres via a worker that runs on a residential connection, sends Discord/ntfy alerts for new listings matching rules, and shows an admin-only map, market stats and worker log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HfF5tnChi8tkCx9svJP6D
16 lines
440 B
TypeScript
16 lines
440 B
TypeScript
import { readFile } from 'node:fs/promises';
|
|
import postgres from 'postgres';
|
|
|
|
if (!process.env.DB_URL) throw new Error('DB_URL is required');
|
|
const client = postgres(process.env.DB_URL, { max: 1 });
|
|
try {
|
|
await client.begin(async (tx) => {
|
|
await tx.unsafe(
|
|
await readFile(new URL('./house-tracker-migration.sql', import.meta.url), 'utf8')
|
|
);
|
|
});
|
|
console.log('House tracker migration applied');
|
|
} finally {
|
|
await client.end();
|
|
}
|