Spaces:
Runtime error
Runtime error
Download scripts/reset-db.ts from dvijaykrishnan/vault-video-processor: direct link, hf CLI and curl.
- Browser
- Download file 871 Bytes
-
https://huggingface.co/spaces/dvijaykrishnan/vault-video-processor/resolve/main/scripts/reset-db.ts
- Command line
-
hf download hf://spaces/dvijaykrishnan/vault-video-processor/scripts/reset-db.ts
-
curl -L -o reset-db.ts https://huggingface.co/spaces/dvijaykrishnan/vault-video-processor/resolve/main/scripts/reset-db.ts
871 Bytes
| 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); | |
| }); | |