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

28
list-databases.ts Normal file
View File

@@ -0,0 +1,28 @@
import "dotenv/config";
import { Pool } from "pg";
async function listDatabases() {
// Connect to default postgres database first
const pool = new Pool({
host: "ep-long-glitter-ao3sjoyu-pooler.c-2.ap-southeast-1.aws.neon.tech",
port: 5432,
user: "neondb_owner",
password: "npg_2ziHMPwZCet9",
database: "postgres",
connectionTimeoutMillis: 10000,
ssl: { rejectUnauthorized: false },
});
try {
const result = await pool.query("SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname;");
console.log("✅ Available databases:");
result.rows.forEach((row: any) => {
console.log(` - ${row.datname}`);
});
await pool.end();
} catch (error) {
console.error("❌ Error:", error instanceof Error ? error.message : String(error));
}
}
listDatabases();