import "dotenv/config"; import "reflect-metadata"; import { DataSource } from "typeorm"; import { member } from "./entities/member"; import { executive_position } from "./entities/executive_position"; import { qualification } from "./entities/qualification"; import { member_awards } from "./entities/member_awards"; import { award } from "./entities/award"; import { city } from "./entities/city"; import { city_district } from "./entities/city_district"; import { membership } from "./entities/membership"; import { authentication } from "./entities/authentication"; import { session } from "./entities/session"; import { Initial1723905344553 } from "./migrations/1723905344553-initial"; import { SplitMember1724064152696 } from "./migrations/1724064152696-split_member"; 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, entities: [ member, executive_position, qualification, member_awards, award, city, city_district, membership, authentication, session, ], migrations: [Initial1723905344553, SplitMember1724064152696], migrationsRun: true, migrationsTransactionMode: "each", subscribers: [], }); export { dataSource };