Skip to content

High performance self-hosted photo and video management solution.

3.6 KB
Raw Blame
-- NOTE: This file is auto generated by ./sql-generator

-- IntegrityRepository.getById
select
  "integrity_report".*
from
  "integrity_report"
where
  "id" = $1

-- IntegrityRepository.getIntegrityReportSummary
select
  "type",
  count(*) as "count"
from
  "integrity_report"
group by
  "type"

-- IntegrityRepository.getIntegrityReport
select
  "id",
  "type",
  "path",
  "assetId",
  "fileAssetId",
  "createdAt"
from
  "integrity_report"
where
  "type" = $1
  and "id" <= $2
order by
  "id" desc
limit
  $3

-- IntegrityRepository.getAssetPathsByPaths
select
  "asset"."originalPath",
  "asset_file"."path" as "encodedVideoPath"
from
  "asset"
  left join "asset_file" on "asset"."id" = "asset_file"."assetId"
  and "asset_file"."type" = $1
where
  (
    "originalPath" in $2
    or "asset_file"."path" in $3
  )

-- IntegrityRepository.getAssetFilePathsByPaths
select
  "path"
from
  "asset_file"
where
  "path" in $1

-- IntegrityRepository.getPersonThumbnailPathsByPaths
select
  "person"."thumbnailPath"
from
  "person"
where
  "person"."thumbnailPath" in $1

-- IntegrityRepository.getTrackedPaths
select
  "asset"."originalPath" as "path"
from
  "asset"
where
  "asset"."originalPath" in $1
union
select
  "asset_file"."path" as "path"
from
  "asset_file"
where
  "asset_file"."path" in $2
union
select
  "person"."thumbnailPath" as "path"
from
  "person"
where
  "person"."thumbnailPath" in $3

-- IntegrityRepository.getAssetCount
select
  count(*) as "count"
from
  "asset"

-- IntegrityRepository.streamAllAssetPaths
select
  "originalPath",
  "asset_file"."path" as "encodedVideoPath"
from
  "asset"
  left join "asset_file" on "asset"."id" = "asset_file"."assetId"
  and "asset_file"."type" = $1

-- IntegrityRepository.streamAllAssetFilePaths
select
  "path"
from
  "asset_file"

-- IntegrityRepository.streamAssetPathsForMissingFiles
select
  "allPaths"."path" as "path",
  "allPaths"."assetId",
  "allPaths"."fileAssetId",
  "integrity_report"."id" as "reportId"
from
  (
    select
      "asset"."originalPath" as "path",
      "asset"."id" as "assetId",
      null::uuid as "fileAssetId"
    from
      "asset"
    where
      "asset"."deletedAt" is null
    union all
    select
      "path",
      null::uuid as "assetId",
      "asset_file"."id" as "fileAssetId"
    from
      "asset_file"
  ) as "allPaths"
  left join "integrity_report" on "integrity_report"."type" = $1
  and (
    "integrity_report"."assetId" = "allPaths"."assetId"
    or "integrity_report"."fileAssetId" = "allPaths"."fileAssetId"
  )

-- IntegrityRepository.streamAssetChecksums
select
  "asset"."originalPath",
  "asset"."checksum",
  "asset"."createdAt",
  "asset"."id" as "assetId",
  "integrity_report"."id" as "reportId"
from
  "asset"
  left join "integrity_report" on "integrity_report"."assetId" = "asset"."id"
  and "integrity_report"."type" = $1
where
  "asset"."deletedAt" is null
  and "asset"."isExternal" = false
  and "asset"."createdAt" >= $2
order by
  "asset"."createdAt" asc

-- IntegrityRepository.streamIntegrityReports
select
  "id",
  "type",
  "path",
  "assetId",
  "fileAssetId"
from
  "integrity_report"
where
  "type" = $1
order by
  "createdAt" desc

-- IntegrityRepository.streamIntegrityReportsWithAssetChecksum
select
  "integrity_report"."id" as "reportId",
  "integrity_report"."path"
from
  "integrity_report"
where
  "integrity_report"."type" = $1

-- IntegrityRepository.streamIntegrityReportsByProperty
select
  "id",
  "path",
  "assetId",
  "fileAssetId"
from
  "integrity_report"
where
  "abcdefghi" is not null

-- IntegrityRepository.deleteById
delete from "integrity_report"
where
  "id" = $1

-- IntegrityRepository.deleteByIds
delete from "integrity_report"
where
  "id" in $1