-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
/
drizzle.config.ts
29 lines (21 loc) · 749 Bytes
/
drizzle.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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: './src/database/server/migrations',
schema: './src/database/server/schemas/lobechat',
strict: true,
} satisfies Config;