openreader/drizzle.config.pg.ts
Richard R 2c23dc9043 refactor(db): remove conditional database usage from API layer
Ensure all metadata operations consistently use the database layer,
removing filesystem-only fallback paths and conditional DB checks.

- Simplified migration scripts to always run on startup
- Updated document/audiobook APIs to always query DB
- Added ensureDbIndexed() calls across all routes
- Extracted test namespace utilities to dedicated module
- Removed migration-manager.ts (functionality consolidated)
- Updated rate limiter to assume DB is always available

BREAKING CHANGE: Database is now required in all configurations.
When auth is disabled, SQLite is used by default at /app/docstore/sqlite3.db.
2026-02-03 12:17:30 -07:00

20 lines
553 B
TypeScript

import type { Config } from 'drizzle-kit';
import * as dotenv from 'dotenv';
dotenv.config();
let url = process.env.POSTGRES_URL;
if (!url) {
//throw new Error('POSTGRES_URL is required for drizzle.config.pg.ts');
console.warn('[drizzle.config.pg.ts] POSTGRES_URL is not set; using a placeholder URL.');
url = 'postgresql://placeholder:placeholder@localhost:5432/placeholder';
}
export default {
schema: './src/db/schema_postgres.ts',
out: './drizzle/postgres',
dialect: 'postgresql',
dbCredentials: {
url,
},
} satisfies Config;