mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
chore(server): sql versioning (#5346)
* chore(server): sql versioning * chore: always add newline to end of file * refactor: generator * chore: pr feedback * chore: pr feedback
This commit is contained in:
parent
ffecfbe075
commit
5e55a17b2a
34 changed files with 3012 additions and 9 deletions
69
server/src/infra/sql/api.key.repository.sql
Normal file
69
server/src/infra/sql/api.key.repository.sql
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- ApiKeyRepository.getKey
|
||||
SELECT DISTINCT
|
||||
"distinctAlias"."APIKeyEntity_id" AS "ids_APIKeyEntity_id"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
"APIKeyEntity"."id" AS "APIKeyEntity_id",
|
||||
"APIKeyEntity"."key" AS "APIKeyEntity_key",
|
||||
"APIKeyEntity"."userId" AS "APIKeyEntity_userId",
|
||||
"APIKeyEntity__APIKeyEntity_user"."id" AS "APIKeyEntity__APIKeyEntity_user_id",
|
||||
"APIKeyEntity__APIKeyEntity_user"."name" AS "APIKeyEntity__APIKeyEntity_user_name",
|
||||
"APIKeyEntity__APIKeyEntity_user"."avatarColor" AS "APIKeyEntity__APIKeyEntity_user_avatarColor",
|
||||
"APIKeyEntity__APIKeyEntity_user"."isAdmin" AS "APIKeyEntity__APIKeyEntity_user_isAdmin",
|
||||
"APIKeyEntity__APIKeyEntity_user"."email" AS "APIKeyEntity__APIKeyEntity_user_email",
|
||||
"APIKeyEntity__APIKeyEntity_user"."storageLabel" AS "APIKeyEntity__APIKeyEntity_user_storageLabel",
|
||||
"APIKeyEntity__APIKeyEntity_user"."externalPath" AS "APIKeyEntity__APIKeyEntity_user_externalPath",
|
||||
"APIKeyEntity__APIKeyEntity_user"."oauthId" AS "APIKeyEntity__APIKeyEntity_user_oauthId",
|
||||
"APIKeyEntity__APIKeyEntity_user"."profileImagePath" AS "APIKeyEntity__APIKeyEntity_user_profileImagePath",
|
||||
"APIKeyEntity__APIKeyEntity_user"."shouldChangePassword" AS "APIKeyEntity__APIKeyEntity_user_shouldChangePassword",
|
||||
"APIKeyEntity__APIKeyEntity_user"."createdAt" AS "APIKeyEntity__APIKeyEntity_user_createdAt",
|
||||
"APIKeyEntity__APIKeyEntity_user"."deletedAt" AS "APIKeyEntity__APIKeyEntity_user_deletedAt",
|
||||
"APIKeyEntity__APIKeyEntity_user"."updatedAt" AS "APIKeyEntity__APIKeyEntity_user_updatedAt",
|
||||
"APIKeyEntity__APIKeyEntity_user"."memoriesEnabled" AS "APIKeyEntity__APIKeyEntity_user_memoriesEnabled"
|
||||
FROM
|
||||
"api_keys" "APIKeyEntity"
|
||||
LEFT JOIN "users" "APIKeyEntity__APIKeyEntity_user" ON "APIKeyEntity__APIKeyEntity_user"."id" = "APIKeyEntity"."userId"
|
||||
AND (
|
||||
"APIKeyEntity__APIKeyEntity_user"."deletedAt" IS NULL
|
||||
)
|
||||
WHERE
|
||||
("APIKeyEntity"."key" = $1)
|
||||
) "distinctAlias"
|
||||
ORDER BY
|
||||
"APIKeyEntity_id" ASC
|
||||
LIMIT
|
||||
1
|
||||
|
||||
-- ApiKeyRepository.getById
|
||||
SELECT
|
||||
"APIKeyEntity"."id" AS "APIKeyEntity_id",
|
||||
"APIKeyEntity"."name" AS "APIKeyEntity_name",
|
||||
"APIKeyEntity"."userId" AS "APIKeyEntity_userId",
|
||||
"APIKeyEntity"."createdAt" AS "APIKeyEntity_createdAt",
|
||||
"APIKeyEntity"."updatedAt" AS "APIKeyEntity_updatedAt"
|
||||
FROM
|
||||
"api_keys" "APIKeyEntity"
|
||||
WHERE
|
||||
(
|
||||
"APIKeyEntity"."userId" = $1
|
||||
AND "APIKeyEntity"."id" = $2
|
||||
)
|
||||
LIMIT
|
||||
1
|
||||
|
||||
-- ApiKeyRepository.getByUserId
|
||||
SELECT
|
||||
"APIKeyEntity"."id" AS "APIKeyEntity_id",
|
||||
"APIKeyEntity"."name" AS "APIKeyEntity_name",
|
||||
"APIKeyEntity"."userId" AS "APIKeyEntity_userId",
|
||||
"APIKeyEntity"."createdAt" AS "APIKeyEntity_createdAt",
|
||||
"APIKeyEntity"."updatedAt" AS "APIKeyEntity_updatedAt"
|
||||
FROM
|
||||
"api_keys" "APIKeyEntity"
|
||||
WHERE
|
||||
("APIKeyEntity"."userId" = $1)
|
||||
ORDER BY
|
||||
"APIKeyEntity"."createdAt" DESC
|
||||
Loading…
Add table
Add a link
Reference in a new issue