update database stuff and and package.json to help generate migrations

This commit is contained in:
Aster Fialla
2026-03-01 12:51:58 -05:00
parent 735084e0a8
commit 7467878dff
4 changed files with 562 additions and 11 deletions

View File

@@ -1,10 +1,11 @@
import "reflect-metadata"
import { DataSource } from "typeorm"
import * as env from 'dotenv';
import * as path from "path";
env.config();
export const AppDataSource = new DataSource({
export default new DataSource({
type: "postgres",
host: "localhost",
port: 5432,
@@ -12,11 +13,15 @@ export const AppDataSource = new DataSource({
password: process.env.POSTGRES_PASSWORD,
database: "postgres",
synchronize: false,
logging: false,
migrations: [__dirname + '/migration/**/*{.js,.ts}'],
entities: ["dist/entities/**/*.js"], // Point to compiled JS files
subscribers: ["dist/subscribers/**/*.js"],
logging: true,
entities: [path.join(__dirname, "./entity/*.{ts,js}")],
migrations: [path.join(__dirname, "./migrations/*.{ts,js}")],
subscribers: ["../subscribers/**/*.{ts, js}"],
migrationsRun: true,
migrationsTableName: 'migrations',
migrationsTransactionMode: 'all'
migrationsTransactionMode: 'all',
invalidWhereValuesBehavior: {
null: "sql-null",
undefined: "throw",
},
})