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

76 lines
2.7 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";
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,
userPermission,
role,
rolePermission,
award,
communication,
communicationType,
executivePosition,
membershipStatus,
qualification,
2024-09-14 09:32:34 +00:00
member,
memberAwards,
memberExecutivePositions,
memberQualifications,
membership,
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-08-27 15:54:59 +00:00
],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };