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:
MythEclipse
2026-05-14 16:25:39 +07:00
parent c63a61460c
commit 35269b5bef
7 changed files with 332 additions and 213 deletions

26
test-pg-connection.ts Normal file
View 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();