ff-admin-server/src/data-source.ts

108 lines
4.1 KiB
TypeScript
Raw Normal View History

import "dotenv/config";
import "reflect-metadata";
import { DataSource } from "typeorm";
2024-08-26 15:00:23 +00:00
import { DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TYPE } from "./env.defaults";
2024-08-25 11:36:19 +00:00
import { user } from "./entity/user";
import { refresh } from "./entity/refresh";
2024-08-25 11:36:19 +00:00
import { invite } from "./entity/invite";
2024-08-27 15:54:59 +00:00
import { userPermission } from "./entity/user_permission";
2024-09-04 09:36:52 +00:00
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";
2024-08-25 11:36:19 +00:00
import { Initial1724317398939 } from "./migrations/1724317398939-initial";
2024-08-25 08:09:57 +00:00
import { RefreshPrimaryChange1724573307851 } from "./migrations/1724573307851-refreshPrimaryChange";
2024-08-25 11:36:19 +00:00
import { Invite1724579024939 } from "./migrations/1724579024939-invite";
import { Permissions1724661484664 } from "./migrations/1724661484664-permissions";
2024-08-27 15:54:59 +00:00
import { RolePermission1724771491085 } from "./migrations/1724771491085-role_permission";
2024-09-04 09:36:52 +00:00
import { MemberBaseData1725435669492 } from "./migrations/1725435669492-member_base_data";
2024-09-14 09:32:34 +00:00
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";
2024-09-27 12:55:34 +00:00
import { CommunicationFields1727439800630 } from "./migrations/1727439800630-communicationFields";
2024-10-07 16:09:27 +00:00
import { Ownership1728313041449 } from "./migrations/1728313041449-ownership";
2024-10-03 11:31:05 +00:00
import { protocol } from "./entity/protocol";
2024-10-10 12:44:41 +00:00
import { protocolAgenda } from "./entity/protocolAgenda";
2024-10-11 12:44:09 +00:00
import { protocolDecision } from "./entity/protocolDecision";
2024-10-10 12:44:41 +00:00
import { protocolPresence } from "./entity/protocolPresence";
2024-10-11 12:44:09 +00:00
import { protocolVoting } from "./entity/protocolVoting";
2024-10-19 14:24:41 +00:00
import { protocolPrintout } from "./entity/protocolPrintout";
2024-10-19 14:35:01 +00:00
import { Protocol1729347911107 } from "./migrations/1729347911107-protocol";
2024-10-26 13:08:05 +00:00
import { calendar } from "./entity/calendar";
import { calendarType } from "./entity/calendarType";
import { Calendar1729947763295 } from "./migrations/1729947763295-calendar";
2024-11-23 11:11:19 +00:00
import { reset } from "./entity/reset";
import { ResetToken1732358596823 } from "./migrations/1732358596823-resetToken";
2024-11-27 09:07:59 +00:00
import { SMSAlarming1732696919191 } from "./migrations/1732696919191-SMSAlarming";
2024-12-03 18:29:38 +00:00
import { SecuringCalendarType1733249553766 } from "./migrations/1733249553766-securingCalendarType";
const dataSource = new DataSource({
2024-08-26 15:00:23 +00:00
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,
2024-09-04 09:36:52 +00:00
entities: [
user,
refresh,
invite,
2024-11-23 11:11:19 +00:00
reset,
2024-09-04 09:36:52 +00:00
userPermission,
role,
rolePermission,
award,
communication,
communicationType,
executivePosition,
membershipStatus,
qualification,
2024-09-14 09:32:34 +00:00
member,
memberAwards,
memberExecutivePositions,
memberQualifications,
membership,
2024-10-03 11:31:05 +00:00
protocol,
2024-10-10 12:44:41 +00:00
protocolAgenda,
2024-10-11 12:44:09 +00:00
protocolDecision,
2024-10-10 12:44:41 +00:00
protocolPresence,
2024-10-11 12:44:09 +00:00
protocolVoting,
2024-10-19 14:24:41 +00:00
protocolPrintout,
2024-10-26 13:08:05 +00:00
calendar,
calendarType,
2024-09-04 09:36:52 +00:00
],
2024-08-27 15:54:59 +00:00
migrations: [
Initial1724317398939,
RefreshPrimaryChange1724573307851,
Invite1724579024939,
Permissions1724661484664,
RolePermission1724771491085,
2024-09-04 09:36:52 +00:00
MemberBaseData1725435669492,
2024-09-14 09:32:34 +00:00
Memberdata1726301836849,
2024-09-27 12:55:34 +00:00
CommunicationFields1727439800630,
2024-10-07 16:09:27 +00:00
Ownership1728313041449,
2024-10-19 14:35:01 +00:00
Protocol1729347911107,
2024-10-26 13:08:05 +00:00
Calendar1729947763295,
2024-11-23 11:11:19 +00:00
ResetToken1732358596823,
2024-11-27 09:07:59 +00:00
SMSAlarming1732696919191,
2024-12-03 18:29:38 +00:00
SecuringCalendarType1733249553766,
2024-08-27 15:54:59 +00:00
],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };