feat: rename schema (#19891)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- PersonRepository.reassignFaces
|
||||
update "asset_faces"
|
||||
update "asset_face"
|
||||
set
|
||||
"personId" = $1
|
||||
where
|
||||
"asset_faces"."personId" = $2
|
||||
"asset_face"."personId" = $2
|
||||
|
||||
-- PersonRepository.delete
|
||||
delete from "person"
|
||||
@@ -17,26 +17,26 @@ select
|
||||
"person".*
|
||||
from
|
||||
"person"
|
||||
inner join "asset_faces" on "asset_faces"."personId" = "person"."id"
|
||||
inner join "assets" on "asset_faces"."assetId" = "assets"."id"
|
||||
and "assets"."visibility" = 'timeline'
|
||||
and "assets"."deletedAt" is null
|
||||
inner join "asset_face" on "asset_face"."personId" = "person"."id"
|
||||
inner join "asset" on "asset_face"."assetId" = "asset"."id"
|
||||
and "asset"."visibility" = 'timeline'
|
||||
and "asset"."deletedAt" is null
|
||||
where
|
||||
"person"."ownerId" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
and "asset_face"."deletedAt" is null
|
||||
and "person"."isHidden" = $2
|
||||
group by
|
||||
"person"."id"
|
||||
having
|
||||
(
|
||||
"person"."name" != $3
|
||||
or count("asset_faces"."assetId") >= $4
|
||||
or count("asset_face"."assetId") >= $4
|
||||
)
|
||||
order by
|
||||
"person"."isHidden" asc,
|
||||
"person"."isFavorite" desc,
|
||||
NULLIF(person.name, '') is null asc,
|
||||
count("asset_faces"."assetId") desc,
|
||||
count("asset_face"."assetId") desc,
|
||||
NULLIF(person.name, '') asc nulls last,
|
||||
"person"."createdAt"
|
||||
limit
|
||||
@@ -49,17 +49,17 @@ select
|
||||
"person".*
|
||||
from
|
||||
"person"
|
||||
left join "asset_faces" on "asset_faces"."personId" = "person"."id"
|
||||
left join "asset_face" on "asset_face"."personId" = "person"."id"
|
||||
where
|
||||
"asset_faces"."deletedAt" is null
|
||||
"asset_face"."deletedAt" is null
|
||||
group by
|
||||
"person"."id"
|
||||
having
|
||||
count("asset_faces"."assetId") = $1
|
||||
count("asset_face"."assetId") = $1
|
||||
|
||||
-- PersonRepository.getFaces
|
||||
select
|
||||
"asset_faces".*,
|
||||
"asset_face".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
@@ -70,20 +70,20 @@ select
|
||||
from
|
||||
"person"
|
||||
where
|
||||
"person"."id" = "asset_faces"."personId"
|
||||
"person"."id" = "asset_face"."personId"
|
||||
) as obj
|
||||
) as "person"
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."assetId" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."assetId" = $1
|
||||
and "asset_face"."deletedAt" is null
|
||||
order by
|
||||
"asset_faces"."boundingBoxX1" asc
|
||||
"asset_face"."boundingBoxX1" asc
|
||||
|
||||
-- PersonRepository.getFaceById
|
||||
select
|
||||
"asset_faces".*,
|
||||
"asset_face".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
@@ -94,33 +94,33 @@ select
|
||||
from
|
||||
"person"
|
||||
where
|
||||
"person"."id" = "asset_faces"."personId"
|
||||
"person"."id" = "asset_face"."personId"
|
||||
) as obj
|
||||
) as "person"
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."id" = $1
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getFaceForFacialRecognitionJob
|
||||
select
|
||||
"asset_faces"."id",
|
||||
"asset_faces"."personId",
|
||||
"asset_faces"."sourceType",
|
||||
"asset_face"."id",
|
||||
"asset_face"."personId",
|
||||
"asset_face"."sourceType",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"assets"."ownerId",
|
||||
"assets"."visibility",
|
||||
"assets"."fileCreatedAt"
|
||||
"asset"."ownerId",
|
||||
"asset"."visibility",
|
||||
"asset"."fileCreatedAt"
|
||||
from
|
||||
"assets"
|
||||
"asset"
|
||||
where
|
||||
"assets"."id" = "asset_faces"."assetId"
|
||||
"asset"."id" = "asset_face"."assetId"
|
||||
) as obj
|
||||
) as "asset",
|
||||
(
|
||||
@@ -133,51 +133,51 @@ select
|
||||
from
|
||||
"face_search"
|
||||
where
|
||||
"face_search"."faceId" = "asset_faces"."id"
|
||||
"face_search"."faceId" = "asset_face"."id"
|
||||
) as obj
|
||||
) as "faceSearch"
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."id" = $1
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getDataForThumbnailGenerationJob
|
||||
select
|
||||
"person"."ownerId",
|
||||
"asset_faces"."boundingBoxX1" as "x1",
|
||||
"asset_faces"."boundingBoxY1" as "y1",
|
||||
"asset_faces"."boundingBoxX2" as "x2",
|
||||
"asset_faces"."boundingBoxY2" as "y2",
|
||||
"asset_faces"."imageWidth" as "oldWidth",
|
||||
"asset_faces"."imageHeight" as "oldHeight",
|
||||
"assets"."type",
|
||||
"assets"."originalPath",
|
||||
"exif"."orientation" as "exifOrientation",
|
||||
"asset_face"."boundingBoxX1" as "x1",
|
||||
"asset_face"."boundingBoxY1" as "y1",
|
||||
"asset_face"."boundingBoxX2" as "x2",
|
||||
"asset_face"."boundingBoxY2" as "y2",
|
||||
"asset_face"."imageWidth" as "oldWidth",
|
||||
"asset_face"."imageHeight" as "oldHeight",
|
||||
"asset"."type",
|
||||
"asset"."originalPath",
|
||||
"asset_exif"."orientation" as "exifOrientation",
|
||||
(
|
||||
select
|
||||
"asset_files"."path"
|
||||
"asset_file"."path"
|
||||
from
|
||||
"asset_files"
|
||||
"asset_file"
|
||||
where
|
||||
"asset_files"."assetId" = "assets"."id"
|
||||
and "asset_files"."type" = 'preview'
|
||||
"asset_file"."assetId" = "asset"."id"
|
||||
and "asset_file"."type" = 'preview'
|
||||
) as "previewPath"
|
||||
from
|
||||
"person"
|
||||
inner join "asset_faces" on "asset_faces"."id" = "person"."faceAssetId"
|
||||
inner join "assets" on "asset_faces"."assetId" = "assets"."id"
|
||||
left join "exif" on "exif"."assetId" = "assets"."id"
|
||||
inner join "asset_face" on "asset_face"."id" = "person"."faceAssetId"
|
||||
inner join "asset" on "asset_face"."assetId" = "asset"."id"
|
||||
left join "asset_exif" on "asset_exif"."assetId" = "asset"."id"
|
||||
where
|
||||
"person"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.reassignFace
|
||||
update "asset_faces"
|
||||
update "asset_face"
|
||||
set
|
||||
"personId" = $1
|
||||
where
|
||||
"asset_faces"."id" = $2
|
||||
"asset_face"."id" = $2
|
||||
|
||||
-- PersonRepository.getByName
|
||||
select
|
||||
@@ -209,15 +209,15 @@ where
|
||||
|
||||
-- PersonRepository.getStatistics
|
||||
select
|
||||
count(distinct ("assets"."id")) as "count"
|
||||
count(distinct ("asset"."id")) as "count"
|
||||
from
|
||||
"asset_faces"
|
||||
left join "assets" on "assets"."id" = "asset_faces"."assetId"
|
||||
and "asset_faces"."personId" = $1
|
||||
and "assets"."visibility" = 'timeline'
|
||||
and "assets"."deletedAt" is null
|
||||
"asset_face"
|
||||
left join "asset" on "asset"."id" = "asset_face"."assetId"
|
||||
and "asset_face"."personId" = $1
|
||||
and "asset"."visibility" = 'timeline'
|
||||
and "asset"."deletedAt" is null
|
||||
where
|
||||
"asset_faces"."deletedAt" is null
|
||||
"asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getNumberOfPeople
|
||||
select
|
||||
@@ -235,18 +235,18 @@ where
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."personId" = "person"."id"
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."personId" = "person"."id"
|
||||
and "asset_face"."deletedAt" is null
|
||||
and exists (
|
||||
select
|
||||
from
|
||||
"assets"
|
||||
"asset"
|
||||
where
|
||||
"assets"."id" = "asset_faces"."assetId"
|
||||
and "assets"."visibility" = 'timeline'
|
||||
and "assets"."deletedAt" is null
|
||||
"asset"."id" = "asset_face"."assetId"
|
||||
and "asset"."visibility" = 'timeline'
|
||||
and "asset"."deletedAt" is null
|
||||
)
|
||||
)
|
||||
and "person"."ownerId" = $2
|
||||
@@ -268,18 +268,18 @@ from
|
||||
|
||||
-- PersonRepository.getFacesByIds
|
||||
select
|
||||
"asset_faces".*,
|
||||
"asset_face".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"assets".*
|
||||
"asset".*
|
||||
from
|
||||
"assets"
|
||||
"asset"
|
||||
where
|
||||
"assets"."id" = "asset_faces"."assetId"
|
||||
"asset"."id" = "asset_face"."assetId"
|
||||
) as obj
|
||||
) as "asset",
|
||||
(
|
||||
@@ -292,24 +292,24 @@ select
|
||||
from
|
||||
"person"
|
||||
where
|
||||
"person"."id" = "asset_faces"."personId"
|
||||
"person"."id" = "asset_face"."personId"
|
||||
) as obj
|
||||
) as "person"
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."assetId" in ($1)
|
||||
and "asset_faces"."personId" in ($2)
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."assetId" in ($1)
|
||||
and "asset_face"."personId" in ($2)
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getRandomFace
|
||||
select
|
||||
"asset_faces".*
|
||||
"asset_face".*
|
||||
from
|
||||
"asset_faces"
|
||||
"asset_face"
|
||||
where
|
||||
"asset_faces"."personId" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
"asset_face"."personId" = $1
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getLatestFaceDate
|
||||
select
|
||||
@@ -318,16 +318,16 @@ from
|
||||
"asset_job_status"
|
||||
|
||||
-- PersonRepository.deleteAssetFace
|
||||
delete from "asset_faces"
|
||||
delete from "asset_face"
|
||||
where
|
||||
"asset_faces"."id" = $1
|
||||
"asset_face"."id" = $1
|
||||
|
||||
-- PersonRepository.softDeleteAssetFaces
|
||||
update "asset_faces"
|
||||
update "asset_face"
|
||||
set
|
||||
"deletedAt" = $1
|
||||
where
|
||||
"asset_faces"."id" = $2
|
||||
"asset_face"."id" = $2
|
||||
|
||||
-- PersonRepository.getForPeopleDelete
|
||||
select
|
||||
|
||||
Reference in New Issue
Block a user