ff-admin-server/src/data-source.ts

27 lines
958 B
TypeScript
Raw Normal View History

import "dotenv/config";
import "reflect-metadata";
import { DataSource } from "typeorm";
import { user } from "./entity/user";
import { refresh } from "./entity/refresh";
import { Initial1724317398939 } from "./migrations/1724317398939-initial";
2024-08-25 08:09:57 +00:00
import { RefreshPrimaryChange1724573307851 } from "./migrations/1724573307851-refreshPrimaryChange";
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,
entities: [user, refresh],
2024-08-25 08:09:57 +00:00
migrations: [Initial1724317398939, RefreshPrimaryChange1724573307851],
migrationsRun: true,
migrationsTransactionMode: "each",
subscribers: [],
});
export { dataSource };