Spaces:
Runtime error
Runtime error
Download scripts/migrate.ts from dvijaykrishnan/vault-video-processor: direct link, hf CLI and curl.
- Browser
- Download file 785 Bytes
-
https://huggingface.co/spaces/dvijaykrishnan/vault-video-processor/resolve/main/scripts/migrate.ts
- Command line
-
hf download hf://spaces/dvijaykrishnan/vault-video-processor/scripts/migrate.ts
-
curl -L -o migrate.ts https://huggingface.co/spaces/dvijaykrishnan/vault-video-processor/resolve/main/scripts/migrate.ts
785 Bytes
| import { drizzle } from 'drizzle-orm/postgres-js'; | |
| import { migrate } from 'drizzle-orm/postgres-js/migrator'; | |
| import postgres from 'postgres'; | |
| import * as dotenv from 'dotenv'; | |
| dotenv.config({ path: '.env.local' }); | |
| const runMigration = async () => { | |
| const connectionString = process.env.DIRECT_URL; | |
| if (!connectionString) { | |
| throw new Error('DIRECT_URL environment variable is not set'); | |
| } | |
| console.log('🔄 Running database migrations...'); | |
| const sql = postgres(connectionString, { max: 1 }); | |
| const db = drizzle(sql); | |
| await migrate(db, { migrationsFolder: './drizzle' }); | |
| await sql.end(); | |
| console.log('✅ Migrations completed successfully'); | |
| }; | |
| runMigration().catch((err) => { | |
| console.error('❌ Migration failed:', err); | |
| process.exit(1); | |
| }); | |