feat: configure postgresql as primary database with neon connection
- Updated .env to use PostgreSQL (neondb) instead of SQLite - Updated drizzle.ts to support DATABASE_URL connection string - Regenerated migrations for PostgreSQL syntax - Bot successfully connects and operates with PostgreSQL - All database operations working correctly
This commit is contained in:
26
test-pg-connection.ts
Normal file
26
test-pg-connection.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import "dotenv/config";
|
||||
import { Pool } from "pg";
|
||||
|
||||
const connectionString = process.env.DATABASE_URL;
|
||||
console.log("Testing connection to:", connectionString?.replace(/:[^:]*@/, ":***@"));
|
||||
|
||||
async function testConnection() {
|
||||
const pool = new Pool({
|
||||
connectionString,
|
||||
connectionTimeoutMillis: 10000,
|
||||
statement_timeout: 10000,
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await pool.query("SELECT NOW()");
|
||||
console.log("✅ Connection successful!");
|
||||
console.log("✅ Query result:", result.rows[0]);
|
||||
await pool.end();
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error("❌ Connection failed:", error instanceof Error ? error.message : String(error));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
testConnection();
|
||||
Reference in New Issue
Block a user