-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathknexfile.js
More file actions
42 lines (41 loc) · 1.05 KB
/
knexfile.js
File metadata and controls
42 lines (41 loc) · 1.05 KB
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
37
38
39
40
41
42
/**
* Knex.js Configuration for Zero-Downtime Migrations
*
* This configuration supports:
* - Pre-deploy hooks (before migrations)
* - Post-deploy hooks (after migrations)
* - Blue-green deployment strategies
* - Health checks during migrations
*/
module.exports = {
client: 'better-sqlite3',
connection: {
filename: process.env.DATABASE_FILENAME || './data/substream.db',
},
useNullAsDefault: true,
migrations: {
directory: './migrations/knex',
extension: 'js',
stub: './migrations/stubs/migration.stub',
loadExtensions: ['.js'],
},
seeds: {
directory: './seeds',
},
pool: {
min: 2,
max: 20,
acquireTimeoutMillis: 30000,
createTimeoutMillis: 5000,
destroyTimeoutMillis: 5000,
idleTimeoutMillis: 30000,
reapIntervalMillis: 1000,
createRetryIntervalMillis: 200,
afterCreate: (conn, done) => {
// Enable WAL mode for better concurrent read performance
conn.run('PRAGMA journal_mode = WAL;');
conn.run('PRAGMA busy_timeout = 5000;');
done(null, conn);
},
},
};