From 9bd86cd6885d7637b8727e38286dc6ecc1f8d059 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Tue, 5 Aug 2025 11:22:17 +0100 Subject: [PATCH] chore: cleanup unused session types and remove comments --- mobile/openapi/lib/model/sync_entity_type.dart | 6 ------ open-api/immich-openapi-specs.json | 2 -- open-api/typescript-sdk/src/fetch-client.ts | 2 -- server/src/dtos/sync.dto.ts | 2 -- server/src/enum.ts | 15 ++++----------- .../1754389095885-ResetAlbumAssetSync.ts | 7 +++++++ 6 files changed, 11 insertions(+), 23 deletions(-) create mode 100644 server/src/schema/migrations/1754389095885-ResetAlbumAssetSync.ts diff --git a/mobile/openapi/lib/model/sync_entity_type.dart b/mobile/openapi/lib/model/sync_entity_type.dart index 7bb7ee52e2..f259fdc9d9 100644 --- a/mobile/openapi/lib/model/sync_entity_type.dart +++ b/mobile/openapi/lib/model/sync_entity_type.dart @@ -46,11 +46,9 @@ class SyncEntityType { static const albumUserDeleteV1 = SyncEntityType._(r'AlbumUserDeleteV1'); static const albumAssetCreateV1 = SyncEntityType._(r'AlbumAssetCreateV1'); static const albumAssetUpdateV1 = SyncEntityType._(r'AlbumAssetUpdateV1'); - static const albumAssetV1 = SyncEntityType._(r'AlbumAssetV1'); static const albumAssetBackfillV1 = SyncEntityType._(r'AlbumAssetBackfillV1'); static const albumAssetExifCreateV1 = SyncEntityType._(r'AlbumAssetExifCreateV1'); static const albumAssetExifUpdateV1 = SyncEntityType._(r'AlbumAssetExifUpdateV1'); - static const albumAssetExifV1 = SyncEntityType._(r'AlbumAssetExifV1'); static const albumAssetExifBackfillV1 = SyncEntityType._(r'AlbumAssetExifBackfillV1'); static const albumToAssetV1 = SyncEntityType._(r'AlbumToAssetV1'); static const albumToAssetDeleteV1 = SyncEntityType._(r'AlbumToAssetDeleteV1'); @@ -95,11 +93,9 @@ class SyncEntityType { albumUserDeleteV1, albumAssetCreateV1, albumAssetUpdateV1, - albumAssetV1, albumAssetBackfillV1, albumAssetExifCreateV1, albumAssetExifUpdateV1, - albumAssetExifV1, albumAssetExifBackfillV1, albumToAssetV1, albumToAssetDeleteV1, @@ -179,11 +175,9 @@ class SyncEntityTypeTypeTransformer { case r'AlbumUserDeleteV1': return SyncEntityType.albumUserDeleteV1; case r'AlbumAssetCreateV1': return SyncEntityType.albumAssetCreateV1; case r'AlbumAssetUpdateV1': return SyncEntityType.albumAssetUpdateV1; - case r'AlbumAssetV1': return SyncEntityType.albumAssetV1; case r'AlbumAssetBackfillV1': return SyncEntityType.albumAssetBackfillV1; case r'AlbumAssetExifCreateV1': return SyncEntityType.albumAssetExifCreateV1; case r'AlbumAssetExifUpdateV1': return SyncEntityType.albumAssetExifUpdateV1; - case r'AlbumAssetExifV1': return SyncEntityType.albumAssetExifV1; case r'AlbumAssetExifBackfillV1': return SyncEntityType.albumAssetExifBackfillV1; case r'AlbumToAssetV1': return SyncEntityType.albumToAssetV1; case r'AlbumToAssetDeleteV1': return SyncEntityType.albumToAssetDeleteV1; diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 528f0d3ce0..74a1407096 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -14946,11 +14946,9 @@ "AlbumUserDeleteV1", "AlbumAssetCreateV1", "AlbumAssetUpdateV1", - "AlbumAssetV1", "AlbumAssetBackfillV1", "AlbumAssetExifCreateV1", "AlbumAssetExifUpdateV1", - "AlbumAssetExifV1", "AlbumAssetExifBackfillV1", "AlbumToAssetV1", "AlbumToAssetDeleteV1", diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 7203cac90a..a1a04ea566 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -4772,11 +4772,9 @@ export enum SyncEntityType { AlbumUserDeleteV1 = "AlbumUserDeleteV1", AlbumAssetCreateV1 = "AlbumAssetCreateV1", AlbumAssetUpdateV1 = "AlbumAssetUpdateV1", - AlbumAssetV1 = "AlbumAssetV1", AlbumAssetBackfillV1 = "AlbumAssetBackfillV1", AlbumAssetExifCreateV1 = "AlbumAssetExifCreateV1", AlbumAssetExifUpdateV1 = "AlbumAssetExifUpdateV1", - AlbumAssetExifV1 = "AlbumAssetExifV1", AlbumAssetExifBackfillV1 = "AlbumAssetExifBackfillV1", AlbumToAssetV1 = "AlbumToAssetV1", AlbumToAssetDeleteV1 = "AlbumToAssetDeleteV1", diff --git a/server/src/dtos/sync.dto.ts b/server/src/dtos/sync.dto.ts index 1aca588b92..9ac85755ab 100644 --- a/server/src/dtos/sync.dto.ts +++ b/server/src/dtos/sync.dto.ts @@ -341,11 +341,9 @@ export type SyncItem = { [SyncEntityType.AlbumUserDeleteV1]: SyncAlbumUserDeleteV1; [SyncEntityType.AlbumAssetCreateV1]: SyncAssetV1; [SyncEntityType.AlbumAssetUpdateV1]: SyncAssetV1; - [SyncEntityType.AlbumAssetV1]: SyncAssetV1; [SyncEntityType.AlbumAssetBackfillV1]: SyncAssetV1; [SyncEntityType.AlbumAssetExifCreateV1]: SyncAssetExifV1; [SyncEntityType.AlbumAssetExifUpdateV1]: SyncAssetExifV1; - [SyncEntityType.AlbumAssetExifV1]: SyncAssetExifV1; [SyncEntityType.AlbumAssetExifBackfillV1]: SyncAssetExifV1; [SyncEntityType.AlbumToAssetV1]: SyncAlbumToAssetV1; [SyncEntityType.AlbumToAssetBackfillV1]: SyncAlbumToAssetV1; diff --git a/server/src/enum.ts b/server/src/enum.ts index c49a9d4756..8c7ee85a32 100644 --- a/server/src/enum.ts +++ b/server/src/enum.ts @@ -668,18 +668,11 @@ export enum SyncEntityType { AlbumUserBackfillV1 = 'AlbumUserBackfillV1', AlbumUserDeleteV1 = 'AlbumUserDeleteV1', - AlbumAssetCreateV1 = 'AlbumAssetCreateV1', // album-to-asset table joined to asset table, updateId from album-to-asset, filter out assets owned by you - AlbumAssetUpdateV1 = 'AlbumAssetUpdateV1', // asset table, updateId from asset table, don't send assets where createdAt == updatedAt, filter out assets owned by you - AlbumAssetV1 = 'AlbumAssetV1', + AlbumAssetCreateV1 = 'AlbumAssetCreateV1', + AlbumAssetUpdateV1 = 'AlbumAssetUpdateV1', AlbumAssetBackfillV1 = 'AlbumAssetBackfillV1', - AlbumAssetExifCreateV1 = 'AlbumAssetExifCreateV1', // album-to-asset table joined to asset-exif table, updateId from album-to-asset, filter out assets owned by you - // If exif isn't created straight away that might cause a problem with the exif createV1, maybe we just send an empty object if it doesn't exist yet? - // We would ack this on album-to-asset table so that would work ok for future syncs - // If exif didn't exist we would send nothing as it would be filtered out when joining from album-to-asset table to the exif table - // Therefore there would be no create event for that asset and it would be skipped forever - // However when the exif is created, we would send an update event for that exif, as the updateId would be new and we no longer filter out exif where createdAt == updatedAt - AlbumAssetExifUpdateV1 = 'AlbumAssetExifUpdateV1', // asset-exif table, updateId from asset-exif table, filter out assets owned by you - AlbumAssetExifV1 = 'AlbumAssetExifV1', + AlbumAssetExifCreateV1 = 'AlbumAssetExifCreateV1', + AlbumAssetExifUpdateV1 = 'AlbumAssetExifUpdateV1', AlbumAssetExifBackfillV1 = 'AlbumAssetExifBackfillV1', AlbumToAssetV1 = 'AlbumToAssetV1', diff --git a/server/src/schema/migrations/1754389095885-ResetAlbumAssetSync.ts b/server/src/schema/migrations/1754389095885-ResetAlbumAssetSync.ts new file mode 100644 index 0000000000..7a3af0ed5f --- /dev/null +++ b/server/src/schema/migrations/1754389095885-ResetAlbumAssetSync.ts @@ -0,0 +1,7 @@ +import { Kysely, sql } from 'kysely'; + +export async function up(db: Kysely): Promise { + await sql`DELETE FROM session_sync_checkpoint WHERE type IN ('AlbumAssetBackfillV1', 'AlbumAssetExifV1', 'AlbumAssetV1')`.execute(db); +} + +export async function down(db: Kysely): Promise {}