immich/server/src/queries/sync.repository.sql

1052 lines
22 KiB
MySQL
Raw Normal View History

-- NOTE: This file is auto generated by ./sql-generator
2025-06-27 13:47:06 -04:00
-- SyncRepository.album.getCreatedAfter
select
2025-06-27 13:47:06 -04:00
"albumsId" as "id",
"createId"
from
2025-07-14 10:13:06 -04:00
"album_user"
where
2025-06-27 13:47:06 -04:00
"usersId" = $1
and "createId" >= $2
and "createId" < $3
order by
2025-06-27 13:47:06 -04:00
"createId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.album.getDeletes
select
"id",
2025-06-27 13:47:06 -04:00
"albumId"
from
"album_audit" as "album_audit"
where
"album_audit"."id" < $1
and "album_audit"."id" > $2
and "userId" = $3
order by
"album_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.album.getUpserts
select distinct
2025-07-14 10:13:06 -04:00
on ("album"."id", "album"."updateId") "album"."id",
"album"."ownerId",
"album"."albumName" as "name",
"album"."description",
"album"."createdAt",
"album"."updatedAt",
"album"."albumThumbnailAssetId" as "thumbnailAssetId",
"album"."isActivityEnabled",
"album"."order",
"album"."updateId"
from
"album" as "album"
2025-07-14 10:13:06 -04:00
left join "album_user" as "album_users" on "album"."id" = "album_users"."albumsId"
where
"album"."updateId" < $1
and "album"."updateId" > $2
2025-06-27 13:47:06 -04:00
and (
"album"."ownerId" = $3
or "album_users"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
order by
2025-07-14 10:13:06 -04:00
"album"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumAsset.getBackfill
select
2025-07-14 10:13:06 -04:00
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
2025-07-14 11:57:25 -04:00
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"album_asset"."updateId"
2025-07-14 10:13:06 -04:00
from
"album_asset" as "album_asset"
inner join "asset" on "asset"."id" = "album_asset"."assetsId"
2025-07-14 10:13:06 -04:00
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" <= $2
and "album_asset"."updateId" >= $3
and "album_asset"."albumsId" = $4
2025-07-14 10:13:06 -04:00
order by
"album_asset"."updateId" asc
-- SyncRepository.albumAsset.getUpdates
select
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
"asset"."updateId"
from
"asset" as "asset"
inner join "album_asset" on "album_asset"."assetsId" = "asset"."id"
inner join "album" on "album"."id" = "album_asset"."albumsId"
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
where
"asset"."updateId" < $1
and "asset"."updateId" > $2
and "album_asset"."updateId" <= $3
and (
"album"."ownerId" = $4
or "album_user"."usersId" = $5
)
order by
"asset"."updateId" asc
-- SyncRepository.albumAsset.getCreates
select
"album_asset"."updateId",
2025-07-14 10:13:06 -04:00
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
2025-07-14 11:57:25 -04:00
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId"
2025-07-14 10:13:06 -04:00
from
"album_asset" as "album_asset"
inner join "asset" on "asset"."id" = "album_asset"."assetsId"
2025-07-14 10:13:06 -04:00
inner join "album" on "album"."id" = "album_asset"."albumsId"
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" > $2
2025-06-27 13:47:06 -04:00
and (
"album"."ownerId" = $3
or "album_user"."usersId" = $4
)
order by
"album_asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumAssetExif.getBackfill
select
2025-07-14 10:13:06 -04:00
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps",
"album_asset"."updateId"
2025-07-14 10:13:06 -04:00
from
"album_asset" as "album_asset"
inner join "asset_exif" on "asset_exif"."assetId" = "album_asset"."assetsId"
2025-07-14 10:13:06 -04:00
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" <= $2
and "album_asset"."updateId" >= $3
and "album_asset"."albumsId" = $4
2025-07-14 10:13:06 -04:00
order by
"album_asset"."updateId" asc
-- SyncRepository.albumAssetExif.getUpdates
select
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps",
"asset_exif"."updateId"
from
"asset_exif" as "asset_exif"
inner join "album_asset" on "album_asset"."assetsId" = "asset_exif"."assetId"
inner join "album" on "album"."id" = "album_asset"."albumsId"
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
where
"asset_exif"."updateId" < $1
and "asset_exif"."updateId" > $2
and "album_asset"."updateId" <= $3
and (
"album"."ownerId" = $4
or "album_user"."usersId" = $5
)
order by
"asset_exif"."updateId" asc
-- SyncRepository.albumAssetExif.getCreates
select
"album_asset"."updateId",
2025-07-14 10:13:06 -04:00
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps"
2025-07-14 10:13:06 -04:00
from
"album_asset" as "album_asset"
inner join "asset_exif" on "asset_exif"."assetId" = "album_asset"."assetsId"
2025-07-14 10:13:06 -04:00
inner join "album" on "album"."id" = "album_asset"."albumsId"
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" > $2
2025-06-27 13:47:06 -04:00
and (
"album"."ownerId" = $3
or "album_user"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
order by
"album_asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumToAsset.getBackfill
select
"album_asset"."assetsId" as "assetId",
"album_asset"."albumsId" as "albumId",
"album_asset"."updateId"
2025-06-27 13:47:06 -04:00
from
"album_asset" as "album_asset"
2025-06-27 13:47:06 -04:00
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" <= $2
and "album_asset"."updateId" >= $3
and "album_asset"."albumsId" = $4
2025-06-27 13:47:06 -04:00
order by
"album_asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumToAsset.getDeletes
select
"id",
"assetId",
"albumId"
from
"album_asset_audit" as "album_asset_audit"
2025-06-27 13:47:06 -04:00
where
"album_asset_audit"."id" < $1
and "album_asset_audit"."id" > $2
and "albumId" in (
2025-06-27 13:47:06 -04:00
select
"id"
from
2025-07-14 10:13:06 -04:00
"album"
2025-06-27 13:47:06 -04:00
where
"ownerId" = $3
2025-06-27 13:47:06 -04:00
union
(
select
2025-07-14 10:13:06 -04:00
"album_user"."albumsId" as "id"
2025-06-27 13:47:06 -04:00
from
2025-07-14 10:13:06 -04:00
"album_user"
2025-06-27 13:47:06 -04:00
where
"album_user"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
)
order by
"album_asset_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumToAsset.getUpserts
select
2025-07-14 10:13:06 -04:00
"album_asset"."assetsId" as "assetId",
"album_asset"."albumsId" as "albumId",
"album_asset"."updateId"
2025-06-27 13:47:06 -04:00
from
"album_asset" as "album_asset"
2025-07-14 10:13:06 -04:00
inner join "album" on "album"."id" = "album_asset"."albumsId"
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
2025-06-27 13:47:06 -04:00
where
"album_asset"."updateId" < $1
and "album_asset"."updateId" > $2
2025-06-27 13:47:06 -04:00
and (
"album"."ownerId" = $3
or "album_user"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
order by
2025-07-14 10:13:06 -04:00
"album_asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumUser.getBackfill
select
2025-07-14 10:13:06 -04:00
"album_user"."albumsId" as "albumId",
"album_user"."usersId" as "userId",
"album_user"."role",
"album_user"."updateId"
2025-06-27 13:47:06 -04:00
from
"album_user" as "album_user"
2025-06-27 13:47:06 -04:00
where
"album_user"."updateId" < $1
and "album_user"."updateId" <= $2
and "album_user"."updateId" >= $3
and "albumsId" = $4
2025-06-27 13:47:06 -04:00
order by
"album_user"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumUser.getDeletes
select
"id",
"userId",
"albumId"
from
"album_user_audit" as "album_user_audit"
2025-06-27 13:47:06 -04:00
where
"album_user_audit"."id" < $1
and "album_user_audit"."id" > $2
and "albumId" in (
2025-06-27 13:47:06 -04:00
select
"id"
from
2025-07-14 10:13:06 -04:00
"album"
2025-06-27 13:47:06 -04:00
where
"ownerId" = $3
2025-06-27 13:47:06 -04:00
union
(
select
2025-07-14 10:13:06 -04:00
"album_user"."albumsId" as "id"
2025-06-27 13:47:06 -04:00
from
2025-07-14 10:13:06 -04:00
"album_user"
2025-06-27 13:47:06 -04:00
where
"album_user"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
)
order by
"album_user_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.albumUser.getUpserts
select
2025-07-14 10:13:06 -04:00
"album_user"."albumsId" as "albumId",
"album_user"."usersId" as "userId",
"album_user"."role",
"album_user"."updateId"
2025-06-27 13:47:06 -04:00
from
"album_user" as "album_user"
2025-06-27 13:47:06 -04:00
where
"album_user"."updateId" < $1
and "album_user"."updateId" > $2
2025-07-14 10:13:06 -04:00
and "album_user"."albumsId" in (
2025-06-27 13:47:06 -04:00
select
"id"
from
2025-07-14 10:13:06 -04:00
"album"
2025-06-27 13:47:06 -04:00
where
"ownerId" = $3
2025-06-27 13:47:06 -04:00
union
(
select
"albumUsers"."albumsId" as "id"
from
2025-07-14 10:13:06 -04:00
"album_user" as "albumUsers"
2025-06-27 13:47:06 -04:00
where
"albumUsers"."usersId" = $4
2025-06-27 13:47:06 -04:00
)
)
order by
2025-07-14 10:13:06 -04:00
"album_user"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.asset.getDeletes
select
"id",
"assetId"
from
"asset_audit" as "asset_audit"
2025-06-27 13:47:06 -04:00
where
"asset_audit"."id" < $1
and "asset_audit"."id" > $2
and "ownerId" = $3
2025-06-27 13:47:06 -04:00
order by
"asset_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.asset.getUpserts
select
2025-07-14 10:13:06 -04:00
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
2025-07-14 11:57:25 -04:00
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
2025-07-14 10:13:06 -04:00
"asset"."updateId"
from
"asset" as "asset"
2025-06-27 13:47:06 -04:00
where
"asset"."updateId" < $1
and "asset"."updateId" > $2
and "ownerId" = $3
2025-06-27 13:47:06 -04:00
order by
"asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.assetExif.getUpserts
select
2025-07-14 10:13:06 -04:00
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps",
"asset_exif"."updateId"
from
"asset_exif" as "asset_exif"
where
"asset_exif"."updateId" < $1
and "asset_exif"."updateId" > $2
and "assetId" in (
select
"id"
from
2025-07-14 10:13:06 -04:00
"asset"
where
"ownerId" = $3
)
order by
"asset_exif"."updateId" asc
-- SyncRepository.assetFace.getDeletes
select
"asset_face_audit"."id",
"assetFaceId"
from
"asset_face_audit" as "asset_face_audit"
left join "asset" on "asset"."id" = "asset_face_audit"."assetId"
where
"asset_face_audit"."id" < $1
and "asset_face_audit"."id" > $2
and "asset"."ownerId" = $3
order by
"asset_face_audit"."id" asc
-- SyncRepository.assetFace.getUpserts
select
"asset_face"."id",
"assetId",
"personId",
"imageWidth",
"imageHeight",
"boundingBoxX1",
"boundingBoxY1",
"boundingBoxX2",
"boundingBoxY2",
"sourceType",
"asset_face"."updateId"
from
"asset_face" as "asset_face"
left join "asset" on "asset"."id" = "asset_face"."assetId"
where
"asset_face"."updateId" < $1
and "asset_face"."updateId" > $2
and "asset"."ownerId" = $3
order by
"asset_face"."updateId" asc
-- SyncRepository.authUser.getUpserts
select
"id",
"name",
"email",
"avatarColor",
"deletedAt",
"updateId",
"profileImagePath",
"profileChangedAt",
"isAdmin",
"pinCode",
"oauthId",
"storageLabel",
"quotaSizeInBytes",
"quotaUsageInBytes"
from
"user" as "user"
where
"user"."updateId" < $1
and "user"."updateId" > $2
order by
"user"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.memory.getDeletes
select
"id",
2025-06-27 13:47:06 -04:00
"memoryId"
from
"memory_audit" as "memory_audit"
where
"memory_audit"."id" < $1
and "memory_audit"."id" > $2
and "userId" = $3
order by
"memory_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.memory.getUpserts
select
"id",
"createdAt",
"updatedAt",
"deletedAt",
"ownerId",
"type",
"data",
"isSaved",
"memoryAt",
"seenAt",
"showAt",
"hideAt",
"updateId"
from
"memory" as "memory"
where
"memory"."updateId" < $1
and "memory"."updateId" > $2
and "ownerId" = $3
order by
"memory"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.memoryToAsset.getDeletes
select
"id",
2025-06-27 13:47:06 -04:00
"memoryId",
"assetId"
from
"memory_asset_audit" as "memory_asset_audit"
where
"memory_asset_audit"."id" < $1
and "memory_asset_audit"."id" > $2
and "memoryId" in (
select
"id"
from
2025-07-14 10:13:06 -04:00
"memory"
2025-06-27 13:47:06 -04:00
where
"ownerId" = $3
)
order by
"memory_asset_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.memoryToAsset.getUpserts
select
2025-06-27 13:47:06 -04:00
"memoriesId" as "memoryId",
"assetsId" as "assetId",
"updateId"
from
"memory_asset" as "memory_asset"
where
"memory_asset"."updateId" < $1
and "memory_asset"."updateId" > $2
and "memoriesId" in (
select
"id"
from
2025-07-14 10:13:06 -04:00
"memory"
where
"ownerId" = $3
)
order by
"memory_asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partner.getCreatedAfter
2025-06-18 10:48:11 -04:00
select
2025-06-27 13:47:06 -04:00
"sharedById",
2025-06-18 10:48:11 -04:00
"createId"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-18 10:48:11 -04:00
where
2025-06-27 13:47:06 -04:00
"sharedWithId" = $1
and "createId" >= $2
and "createId" < $3
2025-06-18 10:48:11 -04:00
order by
2025-07-14 10:13:06 -04:00
"partner"."createId" asc
2025-06-18 10:48:11 -04:00
2025-06-27 13:47:06 -04:00
-- SyncRepository.partner.getDeletes
2025-06-18 10:48:11 -04:00
select
2025-06-27 13:47:06 -04:00
"id",
"sharedById",
"sharedWithId"
2025-06-18 10:48:11 -04:00
from
"partner_audit" as "partner_audit"
2025-06-18 10:48:11 -04:00
where
"partner_audit"."id" < $1
and "partner_audit"."id" > $2
and (
"sharedById" = $3
or "sharedWithId" = $4
2025-06-27 13:47:06 -04:00
)
2025-06-18 10:48:11 -04:00
order by
"partner_audit"."id" asc
2025-06-18 10:48:11 -04:00
2025-06-27 13:47:06 -04:00
-- SyncRepository.partner.getUpserts
select
2025-06-27 13:47:06 -04:00
"sharedById",
"sharedWithId",
"inTimeline",
"updateId"
from
"partner" as "partner"
where
"partner"."updateId" < $1
and "partner"."updateId" > $2
and (
"sharedById" = $3
or "sharedWithId" = $4
)
order by
"partner"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partnerAsset.getBackfill
select
2025-07-14 10:13:06 -04:00
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
2025-07-14 11:57:25 -04:00
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
2025-07-14 10:13:06 -04:00
"asset"."updateId"
from
"asset" as "asset"
where
"asset"."updateId" < $1
and "asset"."updateId" <= $2
and "asset"."updateId" >= $3
and "ownerId" = $4
order by
"asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partnerAsset.getDeletes
select
"id",
"assetId"
from
"asset_audit" as "asset_audit"
2025-06-27 13:47:06 -04:00
where
"asset_audit"."id" < $1
and "asset_audit"."id" > $2
and "ownerId" in (
2025-06-27 13:47:06 -04:00
select
"sharedById"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-27 13:47:06 -04:00
where
"sharedWithId" = $3
2025-06-27 13:47:06 -04:00
)
order by
"asset_audit"."id" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partnerAsset.getUpserts
select
2025-07-14 10:13:06 -04:00
"asset"."id",
"asset"."ownerId",
"asset"."originalFileName",
"asset"."thumbhash",
"asset"."checksum",
"asset"."fileCreatedAt",
"asset"."fileModifiedAt",
"asset"."localDateTime",
"asset"."type",
"asset"."deletedAt",
"asset"."isFavorite",
"asset"."visibility",
"asset"."duration",
2025-07-14 11:57:25 -04:00
"asset"."livePhotoVideoId",
"asset"."stackId",
"asset"."libraryId",
2025-07-14 10:13:06 -04:00
"asset"."updateId"
from
"asset" as "asset"
where
"asset"."updateId" < $1
and "asset"."updateId" > $2
and "ownerId" in (
2025-06-27 13:47:06 -04:00
select
"sharedById"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-27 13:47:06 -04:00
where
"sharedWithId" = $3
)
order by
"asset"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partnerAssetExif.getBackfill
select
2025-07-14 10:13:06 -04:00
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps",
"asset_exif"."updateId"
from
"asset_exif" as "asset_exif"
2025-07-14 10:13:06 -04:00
inner join "asset" on "asset"."id" = "asset_exif"."assetId"
where
"asset_exif"."updateId" < $1
and "asset_exif"."updateId" <= $2
and "asset_exif"."updateId" >= $3
and "asset"."ownerId" = $4
2025-07-14 10:13:06 -04:00
order by
"asset_exif"."updateId" asc
2025-06-27 13:47:06 -04:00
-- SyncRepository.partnerAssetExif.getUpserts
select
2025-07-14 10:13:06 -04:00
"asset_exif"."assetId",
"asset_exif"."description",
"asset_exif"."exifImageWidth",
"asset_exif"."exifImageHeight",
"asset_exif"."fileSizeInByte",
"asset_exif"."orientation",
"asset_exif"."dateTimeOriginal",
"asset_exif"."modifyDate",
"asset_exif"."timeZone",
"asset_exif"."latitude",
"asset_exif"."longitude",
"asset_exif"."projectionType",
"asset_exif"."city",
"asset_exif"."state",
"asset_exif"."country",
"asset_exif"."make",
"asset_exif"."model",
"asset_exif"."lensModel",
"asset_exif"."fNumber",
"asset_exif"."focalLength",
"asset_exif"."iso",
"asset_exif"."exposureTime",
"asset_exif"."profileDescription",
"asset_exif"."rating",
"asset_exif"."fps",
"asset_exif"."updateId"
from
"asset_exif" as "asset_exif"
where
"asset_exif"."updateId" < $1
and "asset_exif"."updateId" > $2
and "assetId" in (
2025-06-27 13:47:06 -04:00
select
"id"
from
2025-07-14 10:13:06 -04:00
"asset"
2025-06-27 13:47:06 -04:00
where
"ownerId" in (
select
"sharedById"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-27 13:47:06 -04:00
where
"sharedWithId" = $3
2025-06-27 13:47:06 -04:00
)
)
2025-06-27 12:20:13 -04:00
order by
"asset_exif"."updateId" asc
2025-06-27 12:20:13 -04:00
2025-06-30 16:41:06 -04:00
-- SyncRepository.partnerStack.getDeletes
select
"id",
"stackId"
from
"stack_audit" as "stack_audit"
2025-06-30 16:41:06 -04:00
where
"stack_audit"."id" < $1
and "stack_audit"."id" > $2
and "userId" in (
2025-06-30 16:41:06 -04:00
select
"sharedById"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-30 16:41:06 -04:00
where
"sharedWithId" = $3
2025-06-30 16:41:06 -04:00
)
order by
"stack_audit"."id" asc
2025-06-30 16:41:06 -04:00
-- SyncRepository.partnerStack.getBackfill
select
2025-07-14 10:13:06 -04:00
"stack"."id",
"stack"."createdAt",
"stack"."updatedAt",
"stack"."primaryAssetId",
"stack"."ownerId",
2025-06-30 16:41:06 -04:00
"updateId"
from
"stack" as "stack"
2025-06-30 16:41:06 -04:00
where
"stack"."updateId" < $1
and "stack"."updateId" <= $2
and "stack"."updateId" >= $3
and "ownerId" = $4
2025-06-30 16:41:06 -04:00
order by
"stack"."updateId" asc
2025-06-30 16:41:06 -04:00
-- SyncRepository.partnerStack.getUpserts
select
2025-07-14 10:13:06 -04:00
"stack"."id",
"stack"."createdAt",
"stack"."updatedAt",
"stack"."primaryAssetId",
"stack"."ownerId",
2025-06-30 16:41:06 -04:00
"updateId"
from
"stack" as "stack"
2025-06-30 16:41:06 -04:00
where
"stack"."updateId" < $1
and "stack"."updateId" > $2
and "ownerId" in (
2025-06-30 16:41:06 -04:00
select
"sharedById"
from
2025-07-14 10:13:06 -04:00
"partner"
2025-06-30 16:41:06 -04:00
where
"sharedWithId" = $3
2025-06-30 16:41:06 -04:00
)
order by
"stack"."updateId" asc
2025-06-30 16:41:06 -04:00
-- SyncRepository.people.getDeletes
select
"id",
"personId"
from
"person_audit" as "person_audit"
where
"person_audit"."id" < $1
and "person_audit"."id" > $2
and "ownerId" = $3
order by
"person_audit"."id" asc
-- SyncRepository.people.getUpserts
select
"id",
"createdAt",
"updatedAt",
"ownerId",
"name",
"birthDate",
"isHidden",
"isFavorite",
"color",
"updateId",
"faceAssetId"
from
"person" as "person"
where
"person"."updateId" < $1
and "person"."updateId" > $2
and "ownerId" = $3
order by
"person"."updateId" asc
2025-06-30 15:26:41 -04:00
-- SyncRepository.stack.getDeletes
select
"id",
"stackId"
from
"stack_audit" as "stack_audit"
2025-06-30 15:26:41 -04:00
where
"stack_audit"."id" < $1
and "stack_audit"."id" > $2
and "userId" = $3
2025-06-30 15:26:41 -04:00
order by
"stack_audit"."id" asc
2025-06-30 15:26:41 -04:00
-- SyncRepository.stack.getUpserts
select
2025-07-14 10:13:06 -04:00
"stack"."id",
"stack"."createdAt",
"stack"."updatedAt",
"stack"."primaryAssetId",
"stack"."ownerId",
2025-06-30 15:26:41 -04:00
"updateId"
from
"stack" as "stack"
2025-06-30 15:26:41 -04:00
where
"stack"."updateId" < $1
and "stack"."updateId" > $2
and "ownerId" = $3
2025-06-30 15:26:41 -04:00
order by
"stack"."updateId" asc
2025-06-30 15:26:41 -04:00
2025-06-27 13:47:06 -04:00
-- SyncRepository.user.getDeletes
2025-06-27 12:20:13 -04:00
select
"id",
2025-06-27 13:47:06 -04:00
"userId"
2025-06-27 12:20:13 -04:00
from
"user_audit" as "user_audit"
2025-06-27 12:20:13 -04:00
where
"user_audit"."id" < $1
and "user_audit"."id" > $2
2025-06-27 12:20:13 -04:00
order by
"user_audit"."id" asc
2025-06-27 12:20:13 -04:00
2025-06-27 13:47:06 -04:00
-- SyncRepository.user.getUpserts
2025-06-27 12:20:13 -04:00
select
2025-06-27 13:47:06 -04:00
"id",
"name",
"email",
2025-07-23 09:59:33 -04:00
"avatarColor",
2025-06-27 13:47:06 -04:00
"deletedAt",
"updateId",
"profileImagePath",
"profileChangedAt"
2025-06-27 12:20:13 -04:00
from
"user" as "user"
2025-06-27 12:20:13 -04:00
where
"user"."updateId" < $1
and "user"."updateId" > $2
2025-06-27 12:20:13 -04:00
order by
"user"."updateId" asc
-- SyncRepository.userMetadata.getDeletes
select
"id",
"userId",
"key"
from
"user_metadata_audit" as "user_metadata_audit"
where
"user_metadata_audit"."id" < $1
and "user_metadata_audit"."id" > $2
and "userId" = $3
order by
"user_metadata_audit"."id" asc
-- SyncRepository.userMetadata.getUpserts
select
"userId",
"key",
"value",
"updateId"
from
"user_metadata" as "user_metadata"
where
"user_metadata"."updateId" < $1
and "user_metadata"."updateId" > $2
and "userId" = $3
order by
"user_metadata"."updateId" asc