-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkysely.config.ts
More file actions
36 lines (31 loc) · 949 Bytes
/
kysely.config.ts
File metadata and controls
36 lines (31 loc) · 949 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
33
34
35
36
import { defineConfig } from 'kysely-ctl'
import { CamelCasePlugin, PostgresDialect } from 'kysely'
import { Pool } from 'pg'
export default defineConfig({
// Database connection using dialect instance with CamelCasePlugin
dialect: new PostgresDialect({
pool: new Pool({
connectionString: process.env.DATABASE_URL,
max: 10,
ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: false } : undefined,
}),
}),
plugins: [new CamelCasePlugin()],
// Migration configuration
migrations: {
migrationFolder: 'migrations',
allowJS: false, // Only allow TypeScript migrations
getMigrationPrefix: () =>
`${new Date()
.toISOString()
.replace(/[-:T.]/g, '')
.slice(0, 14)}_`,
},
// Seed configuration
seeds: {
seedFolder: 'seeds',
allowJS: false, // Only allow TypeScript seeds
},
// Keep connection alive after commands
destroyOnExit: true,
})