mirror of
https://github.com/immich-app/immich.git
synced 2025-09-29 15:31:13 -04:00
865 lines
17 KiB
SQL
865 lines
17 KiB
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- SyncRepository.album.getCreatedAfter
|
|
select
|
|
"albumsId" as "id",
|
|
"createId"
|
|
from
|
|
"album_user"
|
|
where
|
|
"usersId" = $1
|
|
and "createId" >= $2
|
|
and "createdAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"createId" asc
|
|
|
|
-- SyncRepository.album.getDeletes
|
|
select
|
|
"id",
|
|
"albumId"
|
|
from
|
|
"album_audit"
|
|
where
|
|
"userId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.album.getUpserts
|
|
select distinct
|
|
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"
|
|
left join "album_user" as "album_users" on "album"."id" = "album_users"."albumsId"
|
|
where
|
|
"album"."updatedAt" < now() - interval '1 millisecond'
|
|
and (
|
|
"album"."ownerId" = $1
|
|
or "album_users"."usersId" = $2
|
|
)
|
|
order by
|
|
"album"."updateId" asc
|
|
|
|
-- SyncRepository.albumAsset.getBackfill
|
|
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"."updateId"
|
|
from
|
|
"asset"
|
|
inner join "album_asset" on "album_asset"."assetsId" = "asset"."id"
|
|
where
|
|
"album_asset"."albumsId" = $1
|
|
and "asset"."updatedAt" < now() - interval '1 millisecond'
|
|
and "asset"."updateId" <= $2
|
|
and "asset"."updateId" >= $3
|
|
order by
|
|
"asset"."updateId" asc
|
|
|
|
-- SyncRepository.albumAsset.getUpserts
|
|
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"."updateId"
|
|
from
|
|
"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"."updatedAt" < now() - interval '1 millisecond'
|
|
and (
|
|
"album"."ownerId" = $1
|
|
or "album_user"."usersId" = $2
|
|
)
|
|
order by
|
|
"asset"."updateId" asc
|
|
|
|
-- SyncRepository.albumAssetExif.getBackfill
|
|
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"
|
|
inner join "album_asset" on "album_asset"."assetsId" = "asset_exif"."assetId"
|
|
where
|
|
"album_asset"."albumsId" = $1
|
|
and "asset_exif"."updatedAt" < now() - interval '1 millisecond'
|
|
and "asset_exif"."updateId" <= $2
|
|
and "asset_exif"."updateId" >= $3
|
|
order by
|
|
"asset_exif"."updateId" asc
|
|
|
|
-- SyncRepository.albumAssetExif.getUpserts
|
|
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"
|
|
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"."updatedAt" < now() - interval '1 millisecond'
|
|
and (
|
|
"album"."ownerId" = $1
|
|
or "album_user"."usersId" = $2
|
|
)
|
|
order by
|
|
"asset_exif"."updateId" asc
|
|
|
|
-- SyncRepository.albumToAsset.getBackfill
|
|
select
|
|
"album_assets"."assetsId" as "assetId",
|
|
"album_assets"."albumsId" as "albumId",
|
|
"album_assets"."updateId"
|
|
from
|
|
"album_asset" as "album_assets"
|
|
where
|
|
"album_assets"."albumsId" = $1
|
|
and "album_assets"."updatedAt" < now() - interval '1 millisecond'
|
|
and "album_assets"."updateId" <= $2
|
|
and "album_assets"."updateId" >= $3
|
|
order by
|
|
"album_assets"."updateId" asc
|
|
|
|
-- SyncRepository.albumToAsset.getDeletes
|
|
select
|
|
"id",
|
|
"assetId",
|
|
"albumId"
|
|
from
|
|
"album_asset_audit"
|
|
where
|
|
"albumId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"album"
|
|
where
|
|
"ownerId" = $1
|
|
union
|
|
(
|
|
select
|
|
"album_user"."albumsId" as "id"
|
|
from
|
|
"album_user"
|
|
where
|
|
"album_user"."usersId" = $2
|
|
)
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.albumToAsset.getUpserts
|
|
select
|
|
"album_asset"."assetsId" as "assetId",
|
|
"album_asset"."albumsId" as "albumId",
|
|
"album_asset"."updateId"
|
|
from
|
|
"album_asset"
|
|
inner join "album" on "album"."id" = "album_asset"."albumsId"
|
|
left join "album_user" on "album_user"."albumsId" = "album_asset"."albumsId"
|
|
where
|
|
"album_asset"."updatedAt" < now() - interval '1 millisecond'
|
|
and (
|
|
"album"."ownerId" = $1
|
|
or "album_user"."usersId" = $2
|
|
)
|
|
order by
|
|
"album_asset"."updateId" asc
|
|
|
|
-- SyncRepository.albumUser.getBackfill
|
|
select
|
|
"album_user"."albumsId" as "albumId",
|
|
"album_user"."usersId" as "userId",
|
|
"album_user"."role",
|
|
"album_user"."updateId"
|
|
from
|
|
"album_user"
|
|
where
|
|
"albumsId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
and "updateId" <= $2
|
|
and "updateId" >= $3
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.albumUser.getDeletes
|
|
select
|
|
"id",
|
|
"userId",
|
|
"albumId"
|
|
from
|
|
"album_user_audit"
|
|
where
|
|
"albumId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"album"
|
|
where
|
|
"ownerId" = $1
|
|
union
|
|
(
|
|
select
|
|
"album_user"."albumsId" as "id"
|
|
from
|
|
"album_user"
|
|
where
|
|
"album_user"."usersId" = $2
|
|
)
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.albumUser.getUpserts
|
|
select
|
|
"album_user"."albumsId" as "albumId",
|
|
"album_user"."usersId" as "userId",
|
|
"album_user"."role",
|
|
"album_user"."updateId"
|
|
from
|
|
"album_user"
|
|
where
|
|
"album_user"."updatedAt" < now() - interval '1 millisecond'
|
|
and "album_user"."albumsId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"album"
|
|
where
|
|
"ownerId" = $1
|
|
union
|
|
(
|
|
select
|
|
"albumUsers"."albumsId" as "id"
|
|
from
|
|
"album_user" as "albumUsers"
|
|
where
|
|
"albumUsers"."usersId" = $2
|
|
)
|
|
)
|
|
order by
|
|
"album_user"."updateId" asc
|
|
|
|
-- SyncRepository.asset.getDeletes
|
|
select
|
|
"id",
|
|
"assetId"
|
|
from
|
|
"asset_audit"
|
|
where
|
|
"ownerId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.asset.getUpserts
|
|
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"."updateId"
|
|
from
|
|
"asset"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.assetExif.getUpserts
|
|
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"
|
|
where
|
|
"assetId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"asset"
|
|
where
|
|
"ownerId" = $1
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.memory.getDeletes
|
|
select
|
|
"id",
|
|
"memoryId"
|
|
from
|
|
"memory_audit"
|
|
where
|
|
"userId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.memory.getUpserts
|
|
select
|
|
"id",
|
|
"createdAt",
|
|
"updatedAt",
|
|
"deletedAt",
|
|
"ownerId",
|
|
"type",
|
|
"data",
|
|
"isSaved",
|
|
"memoryAt",
|
|
"seenAt",
|
|
"showAt",
|
|
"hideAt",
|
|
"updateId"
|
|
from
|
|
"memory"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.memoryToAsset.getDeletes
|
|
select
|
|
"id",
|
|
"memoryId",
|
|
"assetId"
|
|
from
|
|
"memory_asset_audit"
|
|
where
|
|
"memoryId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"memory"
|
|
where
|
|
"ownerId" = $1
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.memoryToAsset.getUpserts
|
|
select
|
|
"memoriesId" as "memoryId",
|
|
"assetsId" as "assetId",
|
|
"updateId"
|
|
from
|
|
"memory_asset"
|
|
where
|
|
"memoriesId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"memory"
|
|
where
|
|
"ownerId" = $1
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partner.getCreatedAfter
|
|
select
|
|
"sharedById",
|
|
"createId"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
and "createId" >= $2
|
|
and "createdAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"partner"."createId" asc
|
|
|
|
-- SyncRepository.partner.getDeletes
|
|
select
|
|
"id",
|
|
"sharedById",
|
|
"sharedWithId"
|
|
from
|
|
"partner_audit"
|
|
where
|
|
(
|
|
"sharedById" = $1
|
|
or "sharedWithId" = $2
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.partner.getUpserts
|
|
select
|
|
"sharedById",
|
|
"sharedWithId",
|
|
"inTimeline",
|
|
"updateId"
|
|
from
|
|
"partner"
|
|
where
|
|
(
|
|
"sharedById" = $1
|
|
or "sharedWithId" = $2
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partnerAsset.getBackfill
|
|
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"."updateId"
|
|
from
|
|
"asset"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
and "updateId" <= $2
|
|
and "updateId" >= $3
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partnerAsset.getDeletes
|
|
select
|
|
"id",
|
|
"assetId"
|
|
from
|
|
"asset_audit"
|
|
where
|
|
"ownerId" in (
|
|
select
|
|
"sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.partnerAsset.getUpserts
|
|
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"."updateId"
|
|
from
|
|
"asset"
|
|
where
|
|
"ownerId" in (
|
|
select
|
|
"sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partnerAssetExif.getBackfill
|
|
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"
|
|
inner join "asset" on "asset"."id" = "asset_exif"."assetId"
|
|
where
|
|
"asset"."ownerId" = $1
|
|
and "asset_exif"."updatedAt" < now() - interval '1 millisecond'
|
|
and "asset_exif"."updateId" <= $2
|
|
and "asset_exif"."updateId" >= $3
|
|
order by
|
|
"asset_exif"."updateId" asc
|
|
|
|
-- SyncRepository.partnerAssetExif.getUpserts
|
|
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"
|
|
where
|
|
"assetId" in (
|
|
select
|
|
"id"
|
|
from
|
|
"asset"
|
|
where
|
|
"ownerId" in (
|
|
select
|
|
"sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
)
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partnerStack.getDeletes
|
|
select
|
|
"id",
|
|
"stackId"
|
|
from
|
|
"stack_audit"
|
|
where
|
|
"userId" in (
|
|
select
|
|
"sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
)
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.partnerStack.getBackfill
|
|
select
|
|
"stack"."id",
|
|
"stack"."createdAt",
|
|
"stack"."updatedAt",
|
|
"stack"."primaryAssetId",
|
|
"stack"."ownerId",
|
|
"updateId"
|
|
from
|
|
"stack"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
and "updateId" <= $2
|
|
and "updateId" >= $3
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.partnerStack.getUpserts
|
|
select
|
|
"stack"."id",
|
|
"stack"."createdAt",
|
|
"stack"."updatedAt",
|
|
"stack"."primaryAssetId",
|
|
"stack"."ownerId",
|
|
"updateId"
|
|
from
|
|
"stack"
|
|
where
|
|
"ownerId" in (
|
|
select
|
|
"sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"sharedWithId" = $1
|
|
)
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.people.getDeletes
|
|
select
|
|
"id",
|
|
"personId"
|
|
from
|
|
"person_audit"
|
|
where
|
|
"ownerId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.people.getUpserts
|
|
select
|
|
"id",
|
|
"createdAt",
|
|
"updatedAt",
|
|
"ownerId",
|
|
"name",
|
|
"birthDate",
|
|
"thumbnailPath",
|
|
"isHidden",
|
|
"isFavorite",
|
|
"color",
|
|
"updateId",
|
|
"faceAssetId"
|
|
from
|
|
"person"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.stack.getDeletes
|
|
select
|
|
"id",
|
|
"stackId"
|
|
from
|
|
"stack_audit"
|
|
where
|
|
"userId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.stack.getUpserts
|
|
select
|
|
"stack"."id",
|
|
"stack"."createdAt",
|
|
"stack"."updatedAt",
|
|
"stack"."primaryAssetId",
|
|
"stack"."ownerId",
|
|
"updateId"
|
|
from
|
|
"stack"
|
|
where
|
|
"ownerId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.user.getDeletes
|
|
select
|
|
"id",
|
|
"userId"
|
|
from
|
|
"user_audit"
|
|
where
|
|
"deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.user.getUpserts
|
|
select
|
|
"id",
|
|
"name",
|
|
"email",
|
|
"deletedAt",
|
|
"updateId"
|
|
from
|
|
"user"
|
|
where
|
|
"updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|
|
|
|
-- SyncRepository.userMetadata.getDeletes
|
|
select
|
|
"id",
|
|
"userId",
|
|
"key"
|
|
from
|
|
"user_metadata_audit"
|
|
where
|
|
"userId" = $1
|
|
and "deletedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"id" asc
|
|
|
|
-- SyncRepository.userMetadata.getUpserts
|
|
select
|
|
"userId",
|
|
"key",
|
|
"value",
|
|
"updateId"
|
|
from
|
|
"user_metadata"
|
|
where
|
|
"userId" = $1
|
|
and "updatedAt" < now() - interval '1 millisecond'
|
|
order by
|
|
"updateId" asc
|