Spaces:
Runtime error
Runtime error
File size: 871 Bytes
ceb943f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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);
});
|