Spaces:
Runtime error
Runtime error
| import { drizzle } from 'drizzle-orm/postgres-js'; | |
| import postgres from 'postgres'; | |
| import * as dotenv from 'dotenv'; | |
| dotenv.config({ path: '.env.local' }); | |
| const connectionString = process.env.DATABASE_URL!; | |
| if (!connectionString) { | |
| throw new Error('DATABASE_URL is not defined'); | |
| } | |
| const client = postgres(connectionString); | |
| const db = drizzle(client); | |
| async function reset() { | |
| console.log('Dropping tables...'); | |
| await client`DROP TABLE IF EXISTS "users" CASCADE`; | |
| await client`DROP TABLE IF EXISTS "session" CASCADE`; | |
| await client`DROP TABLE IF EXISTS "account" CASCADE`; | |
| await client`DROP TABLE IF EXISTS "verification" CASCADE`; | |
| await client`DROP TABLE IF EXISTS "__drizzle_migrations" CASCADE`; | |
| console.log('Tables dropped.'); | |
| await client.end(); | |
| } | |
| reset().catch((err) => { | |
| console.error(err); | |
| process.exit(1); | |
| }); | |