members-database/data-source.ts

45 lines
1.5 KiB
TypeScript
Raw Permalink 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-17 14:38:08 +00:00
import { executive_position } from "./entities/executive_position";
2024-08-19 10:47:10 +00:00
import { member_awards } from "./entities/member_awards";
import { member_executive_positions } from "./entities/member_executive_positions";
import { member_qualifications } from "./entities/member_qualifications";
import { member } from "./entities/member";
2024-08-19 10:47:10 +00:00
import { membership } from "./entities/membership";
import { membership_status } from "./entities/membership_status";
import { qualification } from "./entities/qualification";
import { Initial1724242210553 } from "./migrations/1724242210553-initial";
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-19 10:47:10 +00:00
executive_position,
member_awards,
member_executive_positions,
member_qualifications,
member,
2024-08-19 10:47:10 +00:00
membership,
membership_status,
qualification,
2024-08-19 10:47:10 +00:00
],
migrations: [Initial1724242210553],
2024-08-17 14:38:08 +00:00
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };