mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 02:13:00 +00:00
Move to migrations. Use npm run generate:db for first database generation.
This commit is contained in:
1 parent
ed6aecf157
commit
32e9d1828c
5 files changed
+22
-8
No files matched your search
@@ -3,7 +3,6 @@ import {
|
||||
BaseEntity,
|
||||
BeforeInsert,
|
||||
BeforeUpdate,
|
||||
DeepPartial,
|
||||
FindOptionsWhere,
|
||||
ObjectIdColumn,
|
||||
PrimaryColumn,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user