From 184a662fda012fab05e8fb6e5e29bea7b642182f Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Mon, 9 Sep 2024 00:40:20 -0400 Subject: [PATCH] fix(server): remove hidden assets from albums (#12449) * fix(server): remove hidden assets from albums * fix: linting --------- Co-authored-by: Daniel Dietzler --- .../1725730782681-RemoveHiddenAssetsFromAlbums.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 server/src/migrations/1725730782681-RemoveHiddenAssetsFromAlbums.ts diff --git a/server/src/migrations/1725730782681-RemoveHiddenAssetsFromAlbums.ts b/server/src/migrations/1725730782681-RemoveHiddenAssetsFromAlbums.ts new file mode 100644 index 0000000000..2dfb5b7978 --- /dev/null +++ b/server/src/migrations/1725730782681-RemoveHiddenAssetsFromAlbums.ts @@ -0,0 +1,13 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class RemoveHiddenAssetsFromAlbums1725730782681 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `DELETE FROM "albums_assets_assets" WHERE "assetsId" IN (SELECT "id" FROM "assets" WHERE "isVisible" = false)`, + ); + } + + public async down(): Promise { + // noop + } +}