members-database/data-source.ts

48 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-08-17 14:38:08 +00:00
import "dotenv/config";
import "reflect-metadata";
import { DataSource } from "typeorm";
import { award } from "./entities/award";
import { communication } from "./entities/communication";
2024-08-23 07:10:40 +00:00
import { communicationType } from "./entities/communicationType";
import { executivePosition } from "./entities/executivePosition";
import { memberAwards } from "./entities/memberAwards";
import { memberExecutivePositions } from "./entities/memberExecutivePositions";
import { memberQualifications } from "./entities/memberQualifications";
import { member } from "./entities/member";
2024-08-19 10:47:10 +00:00
import { membership } from "./entities/membership";
2024-08-23 07:10:40 +00:00
import { membershipStatus } from "./entities/membershipStatus";
import { qualification } from "./entities/qualification";
import { Initial1724242210553 } from "./migrations/1724242210553-initial";
2024-08-23 07:10:40 +00:00
import { NamingAndCleanup1724396667634 } from "./migrations/1724396667634-namingAndCleanup";
2024-08-17 14:38:08 +00:00
const dataSource = new DataSource({
type: "mysql",
host: process.env.NODE_ENV || process.env.PKGMODE ? "localhost" : process.env.DB_HOST,
port: 3306,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: "members",
synchronize: false,
logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"],
bigNumberStrings: false,
2024-08-19 10:47:10 +00:00
entities: [
award,
communication,
2024-08-23 07:10:40 +00:00
communicationType,
executivePosition,
memberAwards,
memberExecutivePositions,
memberQualifications,
member,
2024-08-19 10:47:10 +00:00
membership,
2024-08-23 07:10:40 +00:00
membershipStatus,
qualification,
2024-08-19 10:47:10 +00:00
],
2024-08-23 07:10:40 +00:00
migrations: [Initial1724242210553, NamingAndCleanup1724396667634],
2024-08-17 14:38:08 +00:00
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };