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"; import { CommunicationFields1727439800630 } from "./migrations/1727439800630-communicationFields"; import { Ownership1728313041449 } from "./migrations/1728313041449-ownership"; import { protocol } from "./entity/protocol"; import { protocolAgenda } from "./entity/protocolAgenda"; import { protocolDecision } from "./entity/protocolDecision"; import { protocolPresence } from "./entity/protocolPresence"; import { protocolVoting } from "./entity/protocolVoting"; import { protocolPrintout } from "./entity/protocolPrintout"; import { Protocol1729347911107 } from "./migrations/1729347911107-protocol"; import { calendar } from "./entity/calendar"; import { calendarType } from "./entity/calendarType"; import { Calendar1729947763295 } from "./migrations/1729947763295-calendar"; import { reset } from "./entity/reset"; import { ResetToken1732358596823 } from "./migrations/1732358596823-resetToken"; import { SMSAlarming1732696919191 } from "./migrations/1732696919191-SMSAlarming"; import { SecuringCalendarType1733249553766 } from "./migrations/1733249553766-securingCalendarType"; import { query } from "./entity/query"; import { QueryStore1734187754677 } from "./migrations/1734187754677-queryStore"; import { memberView } from "./views/memberView"; import { memberExecutivePositionsView } from "./views/memberExecutivePositionView"; import { memberQualificationsView } from "./views/memberQualificationsView"; import { membershipView } from "./views/membershipsView"; import { MemberDataViews1734520998539 } from "./migrations/1734520998539-memberDataViews"; import { template } from "./entity/template"; import { Template1734854680201 } from "./migrations/1734854680201-template"; import { templateUsage } from "./entity/templateUsage"; import { TemplateUsage1734949173739 } from "./migrations/1734949173739-templateUsage"; import { newsletter } from "./entity/newsletter"; import { newsletterDates } from "./entity/newsletterDates"; import { newsletterRecipients } from "./entity/newsletterRecipients"; import { Newsletter1735118780511 } from "./migrations/1735118780511-newsletter"; import { newsletterConfig } from "./entity/newsletterConfig"; import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig"; 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, reset, userPermission, role, rolePermission, award, communication, communicationType, executivePosition, membershipStatus, qualification, member, memberAwards, memberExecutivePositions, memberQualifications, membership, protocol, protocolAgenda, protocolDecision, protocolPresence, protocolVoting, protocolPrintout, calendar, calendarType, query, template, templateUsage, newsletter, newsletterDates, newsletterRecipients, newsletterConfig, memberView, memberExecutivePositionsView, memberQualificationsView, membershipView, ], migrations: [ Initial1724317398939, RefreshPrimaryChange1724573307851, Invite1724579024939, Permissions1724661484664, RolePermission1724771491085, MemberBaseData1725435669492, Memberdata1726301836849, CommunicationFields1727439800630, Ownership1728313041449, Protocol1729347911107, Calendar1729947763295, ResetToken1732358596823, SMSAlarming1732696919191, SecuringCalendarType1733249553766, QueryStore1734187754677, MemberDataViews1734520998539, Template1734854680201, TemplateUsage1734949173739, Newsletter1735118780511, NewsletterConfig1735207446910, ], migrationsRun: true, migrationsTransactionMode: "each", subscribers: [], }); export { dataSource };