forked from Shared/esg
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import 'dotenv/config';
|
|
import { join } from 'path';
|
|
import { DataSource } from 'typeorm';
|
|
import { AuditLog } from '../audit/schemas/audit-log.schema';
|
|
import { IdempotencyRecord } from '../idempotency/schemas/idempotency-record.schema';
|
|
import { InquiryLog } from '../logging/schemas/inquiry-log.schema';
|
|
import { DistributedLock } from '../providers/schemas/distributed-lock.schema';
|
|
import { GeneralToken } from '../providers/schemas/general-token.schema';
|
|
import { InquiryResultCache } from '../providers/schemas/inquiry-result-cache.schema';
|
|
import { User } from '../users/schemas/user.schema';
|
|
import { SnakeNamingStrategy } from './snake-naming.strategy';
|
|
|
|
export const AppDataSource = new DataSource({
|
|
type: 'postgres',
|
|
url: process.env.DATABASE_URL ?? 'postgresql://esg:esg@localhost:5432/inquiry_gateway',
|
|
synchronize: false,
|
|
namingStrategy: new SnakeNamingStrategy(),
|
|
entities: [
|
|
User,
|
|
AuditLog,
|
|
InquiryLog,
|
|
InquiryResultCache,
|
|
GeneralToken,
|
|
IdempotencyRecord,
|
|
DistributedLock,
|
|
],
|
|
migrations: [join(__dirname, 'migrations', '*.{js,ts}')],
|
|
});
|