-
Notifications
You must be signed in to change notification settings - Fork 0
/
drizzle.config.ts
36 lines (31 loc) · 971 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
30
31
32
33
34
35
36
//drizzle configuration and tell where is the schema
//drizzle will read this file in root directory
import { Config } from 'drizzle-kit';
//dot env helper
import * as dotenv from 'dotenv';
dotenv.config({ path: '.env' });
export default {
driver: 'pg', //which kind of database is going to interact with
schema: 'src/lib/db/schema.ts', //where is the schema
dbCredentials: {
connectionString: process.env.DATABASE_URL!,
//however, the .env can only be accessed by file under /src, so need other library to help
//! means it is not null
},
} satisfies Config;
// drizzle-kit push:pg
//to push the schema to DB if all configs are correct
/*
change tsconfig.json
"compilerOptions": {
"target": "es5",
...
}
tp "esNext", "es6" if there is ERROR: Transforming const to the configured target environment ("es5") is not supported yet.
TypeScript complier problem
*/
/*
$npx install pg
$npx drizzle-kit studio
To check if it is as expected
*/