Build & Deploy / build-and-push (discord-gateway) (push) Failing after 2m22s
Build & Deploy / build-and-push (backend) (push) Failing after 3m22s
Build & Deploy / build-and-push (proxy) (push) Successful in 1m36s
Build & Deploy / deploy (push) Skipped
- Consolidate all DB schema definitions into packages/shared as single source of truth - Migrate backend from raw SQL to Drizzle ORM across all modules - Extract frontend inline UI into separate component files - Refactor discord-gateway circuitBreaker into conversationState + moderationState - Convert messageStore to Proxy singleton pattern - Add validateBody/validateQuery middleware + Zod schemas for API endpoints - Modernize Docker builds with multi-stage + pnpm deploy - Migrate CI/CD from deployment to image-based pipeline - Remove 60+ unused/dead files (~15K lines) - Update color scheme from sky-blue to teal-cyan - Move DB connection management to @bete/shared/database Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import {
|
|
closeDatabase as sharedCloseDb,
|
|
getDatabase as sharedGetDb,
|
|
getPool as sharedGetPool,
|
|
initializeDatabase as sharedInit,
|
|
} from "@bete/shared/database/init";
|
|
import { createChildLogger } from "@bete/shared/logger";
|
|
import { config } from "../config/index.js";
|
|
|
|
const logger = createChildLogger("database");
|
|
|
|
const dbConfig = {
|
|
DATABASE_URL: config.DATABASE_URL,
|
|
POSTGRES_HOST: config.POSTGRES_HOST as string | undefined,
|
|
POSTGRES_PORT: config.POSTGRES_PORT,
|
|
POSTGRES_USER: config.POSTGRES_USER as string | undefined,
|
|
POSTGRES_PASSWORD: config.POSTGRES_PASSWORD as string | undefined,
|
|
POSTGRES_DB: config.POSTGRES_DB as string | undefined,
|
|
POSTGRES_POOL_MIN: config.POSTGRES_POOL_MIN,
|
|
POSTGRES_POOL_MAX: config.POSTGRES_POOL_MAX,
|
|
};
|
|
|
|
export async function initializeDatabase() {
|
|
logger.info("Initializing database");
|
|
return sharedInit(dbConfig);
|
|
}
|
|
|
|
export function getDatabase() {
|
|
return sharedGetDb();
|
|
}
|
|
|
|
export function getPool() {
|
|
return sharedGetPool();
|
|
}
|
|
|
|
export async function closeDatabase() {
|
|
logger.info("Closing database");
|
|
return sharedCloseDb();
|
|
}
|