Download apps/api/src/scripts/setup-db.js from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 587 Bytes
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/scripts/setup-db.js
- Command line
-
hf download hf://spaces/safetrack/edtech/apps/api/src/scripts/setup-db.js
-
curl -L -o setup-db.js https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/scripts/setup-db.js
587 Bytes
| const { Client } = require('pg'); | |
| const dotenv = require('dotenv'); | |
| dotenv.config(); | |
| async function main() { | |
| const client = new Client({ | |
| connectionString: process.env.DATABASE_URL, | |
| }); | |
| try { | |
| await client.connect(); | |
| console.log('Enabling pgvector...'); | |
| await client.query('CREATE EXTENSION IF NOT EXISTS vector;'); | |
| console.log('✅ pgvector enabled successfully.'); | |
| } catch (err) { | |
| console.error('❌ Failed to enable pgvector:', err); | |
| process.exit(1); | |
| } finally { | |
| await client.end(); | |
| } | |
| } | |
| main(); | |