Spaces:
Sleeping

File size: 1,105 Bytes
7f81110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
// import pg from "pg";
// import dotenv from "dotenv";
// import path from "path";
// import { fileURLToPath } from "url";

// const __dirname = path.dirname(fileURLToPath(import.meta.url));
// dotenv.config({ path: path.join(__dirname, "..", ".env") });

// async function main() {
//     const databaseUrl = process.env.DATABASE_URL;
//     if (!databaseUrl) {
//         console.error("DATABASE_URL not found in .env");
//         process.exit(1);
//     }

//     const { Client } = pg;
//     const client = new Client({
//         connectionString: databaseUrl,
//         ssl: {
//             rejectUnauthorized: false
//         }
//     });

//     try {
//         console.log("Connecting to database...");
//         await client.connect();

//         console.log("Enabling pgvector extension...");
//         await client.query("CREATE EXTENSION IF NOT EXISTS vector;");

//         console.log("Extension enabled successfully!");
//     } catch (err) {
//         console.error("Error enabling extension:", err);
//     } finally {
//         await client.end();
//     }
// }

// main();