initial commit
This commit is contained in:
22
schema/data-source.ts
Normal file
22
schema/data-source.ts
Normal file
@ -0,0 +1,22 @@
|
||||
"use node"
|
||||
import "reflect-metadata"
|
||||
import { DataSource, EntitySchema } from "typeorm"
|
||||
import { classLoader } from "./loader"
|
||||
|
||||
const isProduction = process.env.NODE_ENV === "production"
|
||||
|
||||
export const dataSource = new DataSource({
|
||||
type: "postgres",
|
||||
host: "localhost",
|
||||
port: 5432,
|
||||
username: "test",
|
||||
password: "test",
|
||||
database: "photo",
|
||||
synchronize: !isProduction,
|
||||
logging: !isProduction,
|
||||
migrationsRun: false,
|
||||
entities: classLoader("entity") as EntitySchema[],
|
||||
migrations: classLoader("migration") as Function[],
|
||||
subscribers: [],
|
||||
installExtensions: true
|
||||
})
|
||||
Reference in New Issue
Block a user