From b4c0d6b2700ea0af19910ebc748c7b20de0a5a88 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 22 Oct 2025 08:17:25 +0200 Subject: [PATCH] chore: do a migration to delete bot users with no application --- ...1113394664-delete-bot-users-without-an-application.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts diff --git a/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts b/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts new file mode 100644 index 00000000..02f8a934 --- /dev/null +++ b/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts @@ -0,0 +1,9 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class DeleteBotUsersWithoutAnApplication1761113394664 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DELETE FROM users WHERE bot = true AND id NOT IN (SELECT bot_user_id FROM applications);`); + } + + public async down(queryRunner: QueryRunner): Promise {} +}