| 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(); | |