mirror of
https://github.com/lobehub/lobe-chat.git
synced 2025-12-20 01:12:52 +08:00
* move db * refactor db import * refactor eval types * fix tests * fix tests * fix tests * fix db migration issues * fix docker issue * fix tests * update alias * fix tests * update db test for client and server * refactor db * update codecov * update codecov * update codecov * add docker pr comments
30 lines
740 B
TypeScript
30 lines
740 B
TypeScript
import * as dotenv from 'dotenv';
|
|
import type { Config } from 'drizzle-kit';
|
|
|
|
// Read the .env file if it exists, or a file specified by the
|
|
|
|
// dotenv_config_path parameter that's passed to Node.js
|
|
|
|
dotenv.config();
|
|
|
|
let connectionString = process.env.DATABASE_URL;
|
|
|
|
if (process.env.NODE_ENV === 'test') {
|
|
console.log('current ENV:', process.env.NODE_ENV);
|
|
connectionString = process.env.DATABASE_TEST_URL;
|
|
}
|
|
|
|
if (!connectionString)
|
|
throw new Error('`DATABASE_URL` or `DATABASE_TEST_URL` not found in environment');
|
|
|
|
export default {
|
|
dbCredentials: {
|
|
url: connectionString,
|
|
},
|
|
dialect: 'postgresql',
|
|
out: './packages/database/migrations',
|
|
|
|
schema: './packages/database/src/schemas',
|
|
strict: true,
|
|
} satisfies Config;
|