Switch to TypeORM's DataSource API (#299)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- Switch to TypeORM's DataSource API, rather than using the now deprecated ormconfig.json - This will fix stage deployment not knowing how to deploy the database migrations #297 > **NOTE:** This change requires the deployment scripts to be updated, please update them on the server before merging Co-authored-by: Ethan Lane <ethan@vylpes.com> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/299
This commit is contained in:
parent
c2418381ea
commit
e6c845e3b2
37 changed files with 128 additions and 164 deletions
27
src/database/entities/Server.ts
Normal file
27
src/database/entities/Server.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { Entity, OneToMany } from "typeorm";
|
||||
import BaseEntity from "../../contracts/BaseEntity";
|
||||
import Role from "./Role";
|
||||
import Setting from "./Setting";
|
||||
|
||||
@Entity()
|
||||
export default class Server extends BaseEntity {
|
||||
constructor(serverId: string) {
|
||||
super();
|
||||
|
||||
this.Id = serverId;
|
||||
}
|
||||
|
||||
@OneToMany(() => Setting, x => x.Server)
|
||||
Settings: Setting[];
|
||||
|
||||
@OneToMany(() => Role, x => x.Server)
|
||||
Roles: Role[];
|
||||
|
||||
public AddSettingToServer(setting: Setting) {
|
||||
this.Settings.push(setting);
|
||||
}
|
||||
|
||||
public AddRoleToServer(role: Role) {
|
||||
this.Roles.push(role);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue