mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
modifying setup for typeORM
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
import "reflect-metadata"
|
import "reflect-metadata"
|
||||||
import { DataSource } from "typeorm"
|
import { DataSource } from "typeorm"
|
||||||
import { Member } from "./entity/Member"
|
|
||||||
import { System } from "./entity/System"
|
|
||||||
import * as env from 'dotenv';
|
import * as env from 'dotenv';
|
||||||
|
|
||||||
env.config();
|
env.config();
|
||||||
@@ -13,9 +11,12 @@ export const AppDataSource = new DataSource({
|
|||||||
username: "postgres",
|
username: "postgres",
|
||||||
password: process.env.POSTGRES_PASSWORD,
|
password: process.env.POSTGRES_PASSWORD,
|
||||||
database: "postgres",
|
database: "postgres",
|
||||||
synchronize: true,
|
synchronize: false,
|
||||||
logging: false,
|
logging: false,
|
||||||
entities: [Member, System],
|
migrations: [__dirname + '/migration/**/*{.js,.ts}'],
|
||||||
migrations: [],
|
entities: ["dist/entities/**/*.js"], // Point to compiled JS files
|
||||||
subscribers: [],
|
subscribers: ["dist/subscribers/**/*.js"],
|
||||||
|
migrationsRun: true,
|
||||||
|
migrationsTableName: 'migrations',
|
||||||
|
migrationsTransactionMode: 'all'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
"start": "node src/bot.js",
|
"start": "node src/bot.js",
|
||||||
"start-db": "ts-node database/index.ts",
|
"start-db": "ts-node database/index.ts",
|
||||||
"build-db": "tsc",
|
"build-db": "tsc",
|
||||||
"dev-db": "ts-node --watch database/index.ts"
|
"generate-db": "typeorm migration:generate -d database/build/data-source.js -o",
|
||||||
|
"run-migration": "typeorm-ts-node-commonjs migration:run -d database/data-source.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"target": "es2021",
|
"target": "es2021",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "./build",
|
"outDir": "./database/build",
|
||||||
"rootDir": "./database",
|
"rootDir": "./database",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user