diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-10 16:07:01 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-10 16:07:01 +0200 |
commit | d20a42af18ff641f365bcee2069cb660cc6dbe35 (patch) | |
tree | c80207aacb151589fa22366443eb8dece2abe715 | |
parent | Add migrations (diff) | |
download | server-d20a42af18ff641f365bcee2069cb660cc6dbe35.tar.xz |
Make teams nullable
-rw-r--r-- | api/src/routes/applications/index.ts | 3 | ||||
-rw-r--r-- | util/src/entities/Application.ts | 1 | ||||
-rw-r--r-- | util/src/migrations/mariadb/1660131942703-apps_nullable_team.ts | 18 |
3 files changed, 20 insertions, 2 deletions
diff --git a/api/src/routes/applications/index.ts b/api/src/routes/applications/index.ts index 41ce35b5..033dcc51 100644 --- a/api/src/routes/applications/index.ts +++ b/api/src/routes/applications/index.ts @@ -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); diff --git a/util/src/entities/Application.ts b/util/src/entities/Application.ts index 28381579..103f8e84 100644 --- a/util/src/entities/Application.ts +++ b/util/src/entities/Application.ts @@ -104,6 +104,7 @@ export class Application extends BaseClass { @JoinColumn({ name: "team_id" }) @ManyToOne(() => Team, { onDelete: "CASCADE", + nullable: true }) team?: Team; diff --git a/util/src/migrations/mariadb/1660131942703-apps_nullable_team.ts b/util/src/migrations/mariadb/1660131942703-apps_nullable_team.ts new file mode 100644 index 00000000..ac445772 --- /dev/null +++ b/util/src/migrations/mariadb/1660131942703-apps_nullable_team.ts @@ -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\`) + `); + } + +} |