2024-08-22 09:40:31 +00:00
|
|
|
import "dotenv/config";
|
|
|
|
import "reflect-metadata";
|
|
|
|
import { DataSource } from "typeorm";
|
2024-08-25 11:36:19 +00:00
|
|
|
|
2024-08-22 09:40:31 +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-22 09:40:31 +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";
|
2024-08-22 09:40:31 +00:00
|
|
|
|
|
|
|
const dataSource = new DataSource({
|
|
|
|
type: "mysql",
|
|
|
|
host: process.env.NODE_ENV || process.env.DBMODE ? "localhost" : process.env.DB_HOST,
|
|
|
|
port: 3306,
|
|
|
|
username: process.env.DB_USERNAME,
|
|
|
|
password: process.env.DB_PASSWORD,
|
|
|
|
database: process.env.DB_NAME,
|
|
|
|
synchronize: false,
|
|
|
|
logging: process.env.NODE_ENV ? true : ["schema", "error", "warn", "log", "migration"],
|
|
|
|
bigNumberStrings: false,
|
2024-08-25 11:36:19 +00:00
|
|
|
entities: [user, refresh, invite],
|
|
|
|
migrations: [Initial1724317398939, RefreshPrimaryChange1724573307851, Invite1724579024939],
|
2024-08-22 09:40:31 +00:00
|
|
|
migrationsRun: true,
|
|
|
|
migrationsTransactionMode: "each",
|
|
|
|
subscribers: [],
|
|
|
|
});
|
|
|
|
|
|
|
|
export { dataSource };
|