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

138 lines
5.4 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";
2024-12-14 15:11:53 +00:00
import { query } from "./entity/query";
import { QueryStore1734187754677 } from "./migrations/1734187754677-queryStore";
2024-12-18 11:55:03 +00:00
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";
2024-12-22 09:29:42 +00:00
import { template } from "./entity/template";
import { Template1734854680201 } from "./migrations/1734854680201-template";
2024-12-23 13:00:50 +00:00
import { templateUsage } from "./entity/templateUsage";
import { TemplateUsage1734949173739 } from "./migrations/1734949173739-templateUsage";
2024-12-25 11:22:28 +00:00
import { newsletter } from "./entity/newsletter";
import { newsletterDates } from "./entity/newsletterDates";
import { newsletterRecipients } from "./entity/newsletterRecipients";
import { Newsletter1735118780511 } from "./migrations/1735118780511-newsletter";
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-12-14 15:11:53 +00:00
query,
2024-12-22 09:29:42 +00:00
template,
2024-12-23 13:00:50 +00:00
templateUsage,
2024-12-25 11:22:28 +00:00
newsletter,
newsletterDates,
newsletterRecipients,
2024-12-18 11:55:03 +00:00
memberView,
memberExecutivePositionsView,
memberQualificationsView,
membershipView,
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-12-14 15:11:53 +00:00
QueryStore1734187754677,
2024-12-18 11:55:03 +00:00
MemberDataViews1734520998539,
2024-12-22 09:29:42 +00:00
Template1734854680201,
2024-12-23 13:00:50 +00:00
TemplateUsage1734949173739,
2024-12-25 11:22:28 +00:00
Newsletter1735118780511,
2024-08-27 15:54:59 +00:00
],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };