Make teams nullable

This commit is contained in:
TheArcaneBrony
2022-08-10 16:07:01 +02:00
parent 83f7ee2e61
commit d20a42af18
3 changed files with 20 additions and 2 deletions

View File

@@ -23,10 +23,9 @@ router.post("/", route({}), async (req: Request, res: Response) => {
name: trimSpecial(body.name),
description: "",
bot_public: true,
bot_require_code_grant: false,
owner: user,
verify_key: "IMPLEMENTME",
flags: ""
flags: 0
});
await app.save();
res.json(app).status(200);

View File

@@ -104,6 +104,7 @@ export class Application extends BaseClass {
@JoinColumn({ name: "team_id" })
@ManyToOne(() => Team, {
onDelete: "CASCADE",
nullable: true
})
team?: Team;

View File

@@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class appsNullableTeam1660131942703 implements MigrationInterface {
name = 'appsNullableTeam1660131942703'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
DROP INDEX \`IDX_2ce5a55796fe4c2f77ece57a64\` ON \`applications\`
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE UNIQUE INDEX \`IDX_2ce5a55796fe4c2f77ece57a64\` ON \`applications\` (\`bot_user_id\`)
`);
}
}