diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-18 21:54:20 +1100 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-12-18 22:14:12 +1100 |
commit | 32e9d1828cf9ce55b5179fe9338b82154b5bfeba (patch) | |
tree | 3670e773630724aa48ed4fe2d4c4604454e07071 /src | |
parent | Refactored testclient (diff) | |
download | server-32e9d1828cf9ce55b5179fe9338b82154b5bfeba.tar.xz |
Move to migrations. Use `npm run generate:db` for first database generation.
Diffstat (limited to 'src')
-rw-r--r-- | src/util/entities/BaseClass.ts | 1 | ||||
-rw-r--r-- | src/util/entities/Config.ts | 2 | ||||
-rw-r--r-- | src/util/util/Database.ts | 7 |
3 files changed, 2 insertions, 8 deletions
diff --git a/src/util/entities/BaseClass.ts b/src/util/entities/BaseClass.ts index cb97f513..025c747b 100644 --- a/src/util/entities/BaseClass.ts +++ b/src/util/entities/BaseClass.ts @@ -3,7 +3,6 @@ import { BaseEntity, BeforeInsert, BeforeUpdate, - DeepPartial, FindOptionsWhere, ObjectIdColumn, PrimaryColumn, diff --git a/src/util/entities/Config.ts b/src/util/entities/Config.ts index ff42b412..646737a0 100644 --- a/src/util/entities/Config.ts +++ b/src/util/entities/Config.ts @@ -2,9 +2,7 @@ import { Column, Entity } from "typeorm"; import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass"; import crypto from "crypto"; import { Snowflake } from "../util/Snowflake"; -import { SessionsReplace } from ".."; import { hostname } from "os"; -import { Rights } from "../util/Rights"; @Entity("config") export class ConfigEntity extends BaseClassWithoutId { diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts index f2190bfc..87ee212f 100644 --- a/src/util/util/Database.ts +++ b/src/util/util/Database.ts @@ -1,8 +1,6 @@ import path from "path"; import "reflect-metadata"; import { DataSource } from "typeorm"; -import * as Models from "../entities"; -import { Migration } from "../entities/Migration"; import { yellow, green, red } from "picocolors"; // UUID extension option is only supported with postgres @@ -44,13 +42,12 @@ export async function initDatabase(): Promise<DataSource> { url: isSqlite ? undefined : dbConnectionString, database: isSqlite ? dbConnectionString : undefined, entities: ["dist/util/entities/*.js"], - synchronize: type !== "mongodb", + synchronize: false, logging: false, bigNumberStrings: false, supportBigNumbers: true, name: "default", - // TODO migrations - // migrations: [path.join(__dirname, "..", "migrations", "*.js")], + migrations: ["dist/util/migrations/*.js"], }); dbConnection = await dataSource.initialize(); |