import pg from 'pg' const { Pool } = pg export const pool = new Pool({ connectionString: process.env.DATABASE_URL, }) export async function initDb() { await pool.query(` CREATE TABLE IF NOT EXISTS notices ( id SERIAL PRIMARY KEY, title TEXT NOT NULL, body TEXT NOT NULL, category TEXT NOT NULL DEFAULT 'general', author_name TEXT NOT NULL, author_email TEXT NOT NULL, pinned BOOLEAN NOT NULL DEFAULT FALSE, expires_at TIMESTAMPTZ, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ) `) }