require('dotenv').config(); const { Client } = require('pg'); async function main() { const client = new Client({ host: process.env.DB_HOST, port: process.env.DB_PORT, user: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME, }); await client.connect(); // schema:drop removes entity tables (and their triggers) but keeps these objects. await client.query('DROP TABLE IF EXISTS migrations CASCADE'); await client.query('DROP FUNCTION IF EXISTS recalc_invoice_totals() CASCADE'); await client.query('DROP FUNCTION IF EXISTS recalc_invoice_payments() CASCADE'); await client.end(); } main().catch((error) => { console.error(error); process.exit(1); });