-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmikro-orm.config.ts
More file actions
47 lines (44 loc) · 1.18 KB
/
mikro-orm.config.ts
File metadata and controls
47 lines (44 loc) · 1.18 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
43
44
45
46
47
import { env } from './src/configurations/index.config';
import { defineConfig, PostgreSqlDriver } from '@mikro-orm/postgresql';
import { Migrator } from '@mikro-orm/migrations';
import { SeedManager } from '@mikro-orm/seeder';
import { entities } from './src/entities/index.entity';
import { createMikroOrmLogger } from './src/configurations/logger/mikro-orm-logger';
const getConnectionStrategy = () => {
const isNeon = env.DATABASE_URL.includes('neon.tech');
if (isNeon) {
return {
ssl: {
rejectUnauthorized: false, // required for Neon
},
};
}
return {
ssl: false,
};
};
export default defineConfig({
driver: PostgreSqlDriver,
clientUrl: env.DATABASE_URL,
entities: entities,
extensions: [Migrator, SeedManager],
driverOptions: {
connection: getConnectionStrategy(),
},
debug: env.NODE_ENV === 'development' ? ['query', 'query-params'] : false,
loggerFactory: createMikroOrmLogger,
migrations: {
path: 'dist/src/migrations',
pathTs: 'src/migrations',
},
seeder: {
path: 'dist/src/seeders',
pathTs: 'src/seeders',
},
filters: {
softDelete: {
cond: { deletedAt: null },
default: true,
},
},
});