import "dotenv/config"; import "reflect-metadata"; import { DataSource } from "typeorm"; import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE } from "./env.defaults"; import { user } from "./entity/user"; import { refresh } from "./entity/refresh"; import { invite } from "./entity/invite"; import { userPermission } from "./entity/user_permission"; import { role } from "./entity/role"; import { rolePermission } from "./entity/role_permission"; import { award } from "./entity/award"; import { communication } from "./entity/communication"; import { communicationType } from "./entity/communicationType"; import { executivePosition } from "./entity/executivePosition"; import { membershipStatus } from "./entity/membershipStatus"; import { qualification } from "./entity/qualification"; import { Initial1724317398939 } from "./migrations/1724317398939-initial"; import { RefreshPrimaryChange1724573307851 } from "./migrations/1724573307851-refreshPrimaryChange"; import { Invite1724579024939 } from "./migrations/1724579024939-invite"; import { Permissions1724661484664 } from "./migrations/1724661484664-permissions"; import { RolePermission1724771491085 } from "./migrations/1724771491085-role_permission"; import { MemberBaseData1725435669492 } from "./migrations/1725435669492-member_base_data"; import { member } from "./entity/member"; import { memberAwards } from "./entity/memberAwards"; import { memberExecutivePositions } from "./entity/memberExecutivePositions"; import { memberQualifications } from "./entity/memberQualifications"; import { membership } from "./entity/membership"; import { Memberdata1726301836849 } from "./migrations/1726301836849-memberdata"; const dataSource = new DataSource({ type: DB_TYPE as any, host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : DB_HOST, port: 3306, username: DB_USERNAME, password: DB_PASSWORD, database: DB_NAME, synchronize: false, logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"], bigNumberStrings: false, entities: [ user, refresh, invite, userPermission, role, rolePermission, award, communication, communicationType, executivePosition, membershipStatus, qualification, member, memberAwards, memberExecutivePositions, memberQualifications, membership, ], migrations: [ Initial1724317398939, RefreshPrimaryChange1724573307851, Invite1724579024939, Permissions1724661484664, RolePermission1724771491085, MemberBaseData1725435669492, Memberdata1726301836849, ], migrationsRun: true, migrationsTransactionMode: "each", subscribers: [], }); export { dataSource };