ff-admin-server/src/data-source.ts
2024-11-21 16:00:22 +01:00

99 lines
3.7 KiB
TypeScript

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";
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,
protocol,
protocolAgenda,
protocolDecision,
protocolPresence,
protocolVoting,
protocolPrintout,
calendar,
calendarType,
],
migrations: [
Initial1724317398939,
RefreshPrimaryChange1724573307851,
Invite1724579024939,
Permissions1724661484664,
RolePermission1724771491085,
MemberBaseData1725435669492,
Memberdata1726301836849,
CommunicationFields1727439800630,
Ownership1728313041449,
Protocol1729347911107,
Calendar1729947763295,
],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };