- Add transactions_dirty table and zero-tolerance cleansing action - Implement bookkeeping workbench (/bookkeeping) with searchable Combobox channel selector and card suffix / account identifier - Implement transaction ledger (/transactions) with date groupings, multi-currency metrics, and filters - Update AGENTS.md guidelines for Base UI Select and Combobox bindings
23 lines
619 B
TypeScript
23 lines
619 B
TypeScript
import postgres from "postgres"
|
|
import * as dotenv from "dotenv"
|
|
|
|
dotenv.config({ path: ".env.local" })
|
|
|
|
const sql = postgres(process.env.DATABASE_URL!)
|
|
|
|
async function resetAndInit() {
|
|
console.log("Dropping old tables...")
|
|
await sql`DROP TABLE IF EXISTS transactions CASCADE`
|
|
await sql`DROP TABLE IF EXISTS channels CASCADE`
|
|
await sql`DROP TABLE IF EXISTS accounts CASCADE`
|
|
await sql`DROP TABLE IF EXISTS user_accounts CASCADE`
|
|
await sql`DROP TABLE IF EXISTS users CASCADE`
|
|
console.log("Old tables dropped.")
|
|
await sql.end()
|
|
}
|
|
|
|
resetAndInit().catch((err) => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|