Files
personal-website/scripts/migrate-money-tracker.ts
Stan Runge 0638ead87f
All checks were successful
Test and deploy staging / staging (push) Successful in 1m46s
add money tracker
2026-09-23 17:02:32 +00:00

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('./money-tracker-migration.sql', import.meta.url), 'utf8')
);
});
console.log('Money tracker migration applied');
} finally {
await client.end();
}