13 lines
536 B
TypeScript
13 lines
536 B
TypeScript
import 'dotenv/config';
|
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
import pkg from 'pg';
|
|
import * as schema from './schema.js';
|
|
const { Pool } = pkg;
|
|
const connectionString = process.env.DATABASE_URL;
|
|
const pool = new Pool({ connectionString });
|
|
const db = drizzle(pool, { schema });
|
|
// This will run migrations on the database, skipping the ones already applied
|
|
//await migrate(db, { migrationsFolder: './src/drizzle/migrations' });
|
|
// Don't forget to close the connection, otherwise the script will hang
|
|
//await pool.end();
|