-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrizzle.config.ts
More file actions
32 lines (29 loc) · 865 Bytes
/
Copy pathdrizzle.config.ts
File metadata and controls
32 lines (29 loc) · 865 Bytes
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
30
31
32
import { defineConfig } from 'drizzle-kit';
import { readFileSync } from 'fs';
import { join } from 'path';
// Load environment variables from .env.local
try {
const envFile = readFileSync(join(process.cwd(), '.env.local'), 'utf8');
const envLines = envFile.split('\n');
for (const line of envLines) {
const trimmedLine = line.trim();
if (trimmedLine && !trimmedLine.startsWith('#')) {
const [key, ...valueParts] = trimmedLine.split('=');
if (key && valueParts.length > 0) {
process.env[key] = valueParts.join('=');
}
}
}
} catch (error) {
console.warn('Could not load .env.local file:', error);
}
export default defineConfig({
schema: './lib/db/schema.ts',
out: './lib/db/migrations',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
verbose: true,
strict: true,
});