|
@@ -1,3 +1,4 @@
|
|
|
|
+// We need some kind of module resolver for @db. We use module-alias.
|
|
require("module-alias/register");
|
|
require("module-alias/register");
|
|
|
|
|
|
import * as fs from "fs";
|
|
import * as fs from "fs";
|
|
@@ -5,10 +6,11 @@ import * as path from "path";
|
|
import { client } from "./client";
|
|
import { client } from "./client";
|
|
import { ICommand, BotEvent, IBotCommand } from "./commands/command"
|
|
import { ICommand, BotEvent, IBotCommand } from "./commands/command"
|
|
import "reflect-metadata";
|
|
import "reflect-metadata";
|
|
-import {createConnection} from "typeorm";
|
|
|
|
|
|
+import {createConnection, getConnectionOptions} from "typeorm";
|
|
import { migrate } from "./lowdb_migrator";
|
|
import { migrate } from "./lowdb_migrator";
|
|
import { documentation } from "./util";
|
|
import { documentation } from "./util";
|
|
import dotenv from "dotenv";
|
|
import dotenv from "dotenv";
|
|
|
|
+import { DB_ENTITIES } from "@db/entities";
|
|
|
|
|
|
if(process.env.NODE_ENV == "dev") {
|
|
if(process.env.NODE_ENV == "dev") {
|
|
dotenv.config({
|
|
dotenv.config({
|
|
@@ -107,8 +109,10 @@ client.on("messageReactionAdd", (r, u) => {
|
|
});
|
|
});
|
|
|
|
|
|
async function main() {
|
|
async function main() {
|
|
- await createConnection();
|
|
|
|
- await migrate();
|
|
|
|
|
|
+ await createConnection({
|
|
|
|
+ ...await getConnectionOptions(),
|
|
|
|
+ entities: DB_ENTITIES
|
|
|
|
+ });
|
|
|
|
|
|
let commandsPath = path.resolve(path.dirname(module.filename), "commands");
|
|
let commandsPath = path.resolve(path.dirname(module.filename), "commands");
|
|
let files = fs.readdirSync(commandsPath);
|
|
let files = fs.readdirSync(commandsPath);
|