members-database/data-source.ts
2024-08-17 16:30:11 +02:00

28 lines
1 KiB
TypeScript

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 { authentication } from "./entities/authentication";
import { session } from "./entities/session";
import { Initial1723904760865 } from "./migrations/1723904760865-initial";
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, authentication, session],
migrations: [Initial1723904760865],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };