migration to postgres
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { defineConfig } from 'drizzle-kit';
|
||||
|
||||
const envPath = resolve(__dirname, '../../../.env');
|
||||
try {
|
||||
const text = readFileSync(envPath, 'utf-8');
|
||||
for (const line of text.split('\n')) {
|
||||
const match = line.match(/^(\w+)=(.*)$/);
|
||||
if (match) {
|
||||
const [, key, val] = match;
|
||||
if (!process.env[key!]) process.env[key!] = val!.replace(/^["']|["']$/g, '');
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
|
||||
export default defineConfig({
|
||||
schema: './src/schema/index.ts',
|
||||
out: './migrations',
|
||||
dialect: 'postgresql',
|
||||
dbCredentials: {
|
||||
url: process.env.POSTGRES_URL!,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user