gimmich

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

schema.sql (126973B)


      1 --
      2 -- PostgreSQL database dump
      3 --
      4 
      5 -- \restrict mjMyY2YEVBfWGabnjdRqEcQmimigWbvovifIDg4VxfkA30tCaxYDjnokejkP5XZ
      6 
      7 -- Dumped from database version 14.19 (Debian 14.19-1.pgdg12+1)
      8 -- Dumped by pg_dump version 14.19 (Debian 14.19-1.pgdg12+1)
      9 
     10 -- SET statement_timeout = 0;
     11 -- SET lock_timeout = 0;
     12 -- SET idle_in_transaction_session_timeout = 0;
     13 -- SET client_encoding = 'UTF8';
     14 -- SET standard_conforming_strings = on;
     15 -- SELECT pg_catalog.set_config('search_path', '', false);
     16 -- SET check_function_bodies = false;
     17 -- SET xmloption = content;
     18 -- SET client_min_messages = warning;
     19 -- SET row_security = off;
     20 
     21 --
     22 -- Name: cube; Type: EXTENSION; Schema: -; Owner: -
     23 --
     24 
     25 -- CREATE EXTENSION IF NOT EXISTS cube WITH SCHEMA public;
     26 
     27 
     28 --
     29 -- Name: EXTENSION cube; Type: COMMENT; Schema: -; Owner: 
     30 --
     31 
     32 -- COMMENT ON EXTENSION cube IS 'data type for multidimensional cubes';
     33 
     34 
     35 --
     36 -- Name: earthdistance; Type: EXTENSION; Schema: -; Owner: -
     37 --
     38 
     39 -- CREATE EXTENSION IF NOT EXISTS earthdistance WITH SCHEMA public;
     40 
     41 
     42 --
     43 -- Name: EXTENSION earthdistance; Type: COMMENT; Schema: -; Owner: 
     44 --
     45 
     46 -- COMMENT ON EXTENSION earthdistance IS 'calculate great-circle distances on the surface of the Earth';
     47 
     48 
     49 --
     50 -- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
     51 --
     52 
     53 -- CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
     54 
     55 
     56 --
     57 -- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: 
     58 --
     59 
     60 -- COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
     61 
     62 
     63 --
     64 -- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
     65 --
     66 
     67 -- CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
     68 
     69 
     70 --
     71 -- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: 
     72 --
     73 
     74 -- COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
     75 
     76 
     77 --
     78 -- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
     79 --
     80 
     81 -- CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
     82 
     83 
     84 --
     85 -- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: 
     86 --
     87 
     88 -- COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
     89 
     90 
     91 --
     92 -- Name: vector; Type: EXTENSION; Schema: -; Owner: -
     93 --
     94 
     95 -- CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public;
     96 
     97 
     98 --
     99 -- Name: EXTENSION vector; Type: COMMENT; Schema: -; Owner: 
    100 --
    101 
    102 -- COMMENT ON EXTENSION vector IS 'vector data type and ivfflat and hnsw access methods';
    103 
    104 
    105 --
    106 -- Name: vchord; Type: EXTENSION; Schema: -; Owner: -
    107 --
    108 
    109 -- CREATE EXTENSION IF NOT EXISTS vchord WITH SCHEMA public;
    110 
    111 
    112 --
    113 -- Name: EXTENSION vchord; Type: COMMENT; Schema: -; Owner: 
    114 --
    115 
    116 -- COMMENT ON EXTENSION vchord IS 'vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM';
    117 
    118 
    119 --
    120 -- Name: album_user_role_enum; Type: TYPE; Schema: public; Owner: postgres
    121 --
    122 
    123 -- ENuM not supported in sqlite
    124 -- CREATE TYPE album_user_role_enum AS ENUM (
    125 --     'owner',
    126 --     'editor',
    127 --     'viewer'
    128 -- );
    129 
    130 
    131 -- ALTER TYPE album_user_role_enum OWNER TO postgres;
    132 
    133 --
    134 -- Name: asset_checksum_algorithm_enum; Type: TYPE; Schema: public; Owner: postgres
    135 --
    136 
    137 -- CREATE TYPE asset_checksum_algorithm_enum AS ENUM (
    138 --     'sha1',
    139 --     'sha1-path'
    140 -- );
    141 
    142 
    143 -- ALTER TYPE asset_checksum_algorithm_enum OWNER TO postgres;
    144 
    145 --
    146 -- Name: asset_visibility_enum; Type: TYPE; Schema: public; Owner: postgres
    147 --
    148 
    149 -- CREATE TYPE asset_visibility_enum AS ENUM (
    150 --     'archive',
    151 --     'timeline',
    152 --     'hidden',
    153 --     'locked'
    154 -- );
    155 
    156 
    157 -- ALTER TYPE asset_visibility_enum OWNER TO postgres;
    158 
    159 --
    160 -- Name: assets_status_enum; Type: TYPE; Schema: public; Owner: postgres
    161 --
    162 
    163 -- CREATE TYPE assets_status_enum AS ENUM (
    164 --     'active',
    165 --     'trashed',
    166 --     'deleted'
    167 -- );
    168 
    169 
    170 -- ALTER TYPE assets_status_enum OWNER TO postgres;
    171 
    172 --
    173 -- Name: sourcetype; Type: TYPE; Schema: public; Owner: postgres
    174 --
    175 
    176 -- CREATE TYPE sourcetype AS ENUM (
    177 --     'machine-learning',
    178 --     'exif',
    179 --     'manual'
    180 -- );
    181 
    182 
    183 -- ALTER TYPE sourcetype OWNER TO postgres;
    184 
    185 --
    186 -- Name: video_stream_variant_codec_enum; Type: TYPE; Schema: public; Owner: postgres
    187 --
    188 
    189 -- CREATE TYPE video_stream_variant_codec_enum AS ENUM (
    190 --     'av1',
    191 --     'hevc',
    192 --     'h264'
    193 -- );
    194 
    195 
    196 -- ALTER TYPE video_stream_variant_codec_enum OWNER TO postgres;
    197 
    198 --
    199 -- Name: album_asset_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    200 --
    201 
    202 -- CREATE FUNCTION album_asset_delete_audit() RETURNS trigger
    203 --     LANGUAGE plpgsql
    204 --     AS $$
    205 --     BEGIN
    206 --       INSERT INTO album_asset_audit ("albumId", "assetId")
    207 --       SELECT "albumId", "assetId" FROM OLD
    208 --       WHERE "albumId" IN (SELECT "id" FROM album WHERE "id" IN (SELECT "albumId" FROM OLD));
    209 --       RETURN NULL;
    210 --     END
    211 --   $$;
    212 
    213 
    214 -- ALTER FUNCTION album_asset_delete_audit() OWNER TO postgres;
    215 
    216 --
    217 -- Name: album_user_after_insert(); Type: FUNCTION; Schema: public; Owner: postgres
    218 --
    219 
    220 -- CREATE FUNCTION album_user_after_insert() RETURNS trigger
    221 --     LANGUAGE plpgsql
    222 --     AS $$
    223 --     BEGIN
    224 --       UPDATE album SET "updatedAt" = current_timestamp, "updateId" = immich_uuid_v7(current_timestamp)
    225 --       WHERE "id" IN (SELECT "albumId" FROM inserted_rows)
    226 --         AND NOT EXISTS (SELECT FROM inserted_rows WHERE role = 'owner');
    227 --       RETURN NULL;
    228 --     END
    229 --   $$;
    230 
    231 
    232 -- ALTER FUNCTION album_user_after_insert() OWNER TO postgres;
    233 
    234 --
    235 -- Name: album_user_delete(); Type: FUNCTION; Schema: public; Owner: postgres
    236 --
    237 
    238 -- CREATE FUNCTION album_user_delete() RETURNS trigger
    239 --     LANGUAGE plpgsql
    240 --     AS $$
    241 --     BEGIN
    242 --       DELETE FROM "album"
    243 --       WHERE "album"."id" = OLD."albumId"
    244 --       AND NOT EXISTS (SELECT "albumId" FROM "album_user" WHERE "album_user"."albumId" = "album"."id" AND "album_user"."role" = 'owner');
    245 
    246 --       RETURN NULL;
    247 --     END
    248 --   $$;
    249 
    250 
    251 -- ALTER FUNCTION album_user_delete() OWNER TO postgres;
    252 
    253 --
    254 -- Name: album_user_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    255 --
    256 
    257 -- CREATE FUNCTION album_user_delete_audit() RETURNS trigger
    258 --     LANGUAGE plpgsql
    259 --     AS $$
    260 --     BEGIN
    261 --       INSERT INTO album_audit ("albumId", "userId")
    262 --       SELECT "albumId", "userId"
    263 --       FROM OLD;
    264 
    265 --       IF pg_trigger_depth() = 1 THEN
    266 --         INSERT INTO album_user_audit ("albumId", "userId")
    267 --         SELECT "albumId", "userId"
    268 --         FROM OLD;
    269 --       END IF;
    270 
    271 --       RETURN NULL;
    272 --     END
    273 --   $$;
    274 
    275 
    276 -- ALTER FUNCTION album_user_delete_audit() OWNER TO postgres;
    277 
    278 --
    279 -- Name: asset_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    280 --
    281 
    282 -- CREATE FUNCTION asset_delete_audit() RETURNS trigger
    283 --     LANGUAGE plpgsql
    284 --     AS $$
    285 --     BEGIN
    286 --       INSERT INTO asset_audit ("assetId", "ownerId")
    287 --       SELECT "id", "ownerId"
    288 --       FROM OLD;
    289 --       RETURN NULL;
    290 --     END
    291 --   $$;
    292 
    293 
    294 -- ALTER FUNCTION asset_delete_audit() OWNER TO postgres;
    295 
    296 --
    297 -- Name: asset_edit_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    298 --
    299 
    300 -- CREATE FUNCTION asset_edit_audit() RETURNS trigger
    301 --     LANGUAGE plpgsql
    302 --     AS $$
    303 --     BEGIN
    304 --       INSERT INTO asset_edit_audit ("editId", "assetId")
    305 --       SELECT "id", "assetId"
    306 --       FROM OLD;
    307 --       RETURN NULL;
    308 --     END
    309 --   $$;
    310 
    311 
    312 -- ALTER FUNCTION asset_edit_audit() OWNER TO postgres;
    313 
    314 --
    315 -- Name: asset_edit_delete(); Type: FUNCTION; Schema: public; Owner: postgres
    316 --
    317 
    318 -- CREATE FUNCTION asset_edit_delete() RETURNS trigger
    319 --     LANGUAGE plpgsql
    320 --     AS $$
    321 --     BEGIN
    322 --       UPDATE asset
    323 --       SET "isEdited" = false
    324 --       FROM deleted_edit
    325 --       WHERE asset.id = deleted_edit."assetId" AND asset."isEdited"
    326 --         AND NOT EXISTS (SELECT FROM asset_edit edit WHERE edit."assetId" = asset.id);
    327 --       RETURN NULL;
    328 --     END
    329 --   $$;
    330 
    331 
    332 -- ALTER FUNCTION asset_edit_delete() OWNER TO postgres;
    333 
    334 --
    335 -- Name: asset_edit_insert(); Type: FUNCTION; Schema: public; Owner: postgres
    336 --
    337 
    338 -- CREATE FUNCTION asset_edit_insert() RETURNS trigger
    339 --     LANGUAGE plpgsql
    340 --     AS $$
    341 --     BEGIN
    342 --       UPDATE asset
    343 --       SET "isEdited" = true
    344 --       FROM inserted_edit
    345 --       WHERE asset.id = inserted_edit."assetId" AND NOT asset."isEdited";
    346 --       RETURN NULL;
    347 --     END
    348 --   $$;
    349 
    350 
    351 -- ALTER FUNCTION asset_edit_insert() OWNER TO postgres;
    352 
    353 --
    354 -- Name: asset_face_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    355 --
    356 
    357 -- CREATE FUNCTION asset_face_audit() RETURNS trigger
    358 --     LANGUAGE plpgsql
    359 --     AS $$
    360 --     BEGIN
    361 --       INSERT INTO asset_face_audit ("assetFaceId", "assetId")
    362 --       SELECT "id", "assetId"
    363 --       FROM OLD;
    364 --       RETURN NULL;
    365 --     END
    366 --   $$;
    367 
    368 
    369 -- ALTER FUNCTION asset_face_audit() OWNER TO postgres;
    370 
    371 --
    372 -- Name: asset_metadata_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    373 --
    374 
    375 -- CREATE FUNCTION asset_metadata_audit() RETURNS trigger
    376 --     LANGUAGE plpgsql
    377 --     AS $$
    378 --     BEGIN
    379 --       INSERT INTO asset_metadata_audit ("assetId", "key")
    380 --       SELECT "assetId", "key"
    381 --       FROM OLD;
    382 --       RETURN NULL;
    383 --     END
    384 --   $$;
    385 
    386 
    387 -- ALTER FUNCTION asset_metadata_audit() OWNER TO postgres;
    388 
    389 --
    390 -- Name: asset_ocr_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    391 --
    392 
    393 -- CREATE FUNCTION asset_ocr_delete_audit() RETURNS trigger
    394 --     LANGUAGE plpgsql
    395 --     AS $$
    396 --     BEGIN
    397 --       INSERT INTO asset_ocr_audit ("assetId")
    398 --       SELECT "assetId"
    399 --       FROM OLD;
    400 --       RETURN NULL;
    401 --     END
    402 --   $$;
    403 
    404 
    405 -- ALTER FUNCTION asset_ocr_delete_audit() OWNER TO postgres;
    406 
    407 --
    408 -- Name: f_concat_ws(text, text[]); Type: FUNCTION; Schema: public; Owner: postgres
    409 --
    410 
    411 -- CREATE FUNCTION f_concat_ws(text, text[]) RETURNS text
    412 --     LANGUAGE sql IMMUTABLE PARALLEL SAFE
    413 --     AS $_$SELECT array_to_string($2, $1)$_$;
    414 
    415 
    416 -- ALTER FUNCTION f_concat_ws(text, text[]) OWNER TO postgres;
    417 
    418 --
    419 -- Name: f_unaccent(text); Type: FUNCTION; Schema: public; Owner: postgres
    420 --
    421 
    422 -- CREATE FUNCTION f_unaccent(text) RETURNS text
    423 --     LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
    424 --     RETURN unaccent('public.unaccent'::regdictionary, $1);
    425 
    426 
    427 -- ALTER FUNCTION f_unaccent(text) OWNER TO postgres;
    428 
    429 --
    430 -- Name: immich_uuid_v7(text); Type: FUNCTION; Schema: public; Owner: postgres
    431 --
    432 
    433 -- CREATE FUNCTION immich_uuid_v7(p_timestamp text DEFAULT current_timestamp) RETURNS uuid
    434 --     LANGUAGE sql
    435 --     AS $$
    436 --     select encode(
    437 --       set_bit(
    438 --         set_bit(
    439 --           overlay(uuid_send(gen_random_uuid())
    440 --                   placing substring(int8send(floor(extract(epoch from p_timestamp) * 1000)::bigint) from 3)
    441 --                   from 1 for 6
    442 --           ),
    443 --           52, 1
    444 --         ),
    445 --         53, 1
    446 --       ),
    447 --       'hex')::uuid;
    448 --   $$;
    449 
    450 
    451 -- ALTER FUNCTION immich_uuid_v7(p_timestamp text) OWNER TO postgres;
    452 
    453 --
    454 -- Name: ll_to_earth_public(real, real); Type: FUNCTION; Schema: public; Owner: postgres
    455 --
    456 
    457 -- CREATE FUNCTION ll_to_earth_public(latitude real, longitude real) RETURNS earth
    458 --     LANGUAGE sql IMMUTABLE STRICT PARALLEL SAFE
    459 --     AS $$
    460 --     SELECT cube(public.cube(public.cube(public.earth()*cos(radians(latitude))*cos(radians(longitude))),public.earth()*cos(radians(latitude))*sin(radians(longitude))),public.earth()*sin(radians(latitude)))::public.earth
    461 --   $$;
    462 
    463 
    464 -- ALTER FUNCTION ll_to_earth_public(latitude real, longitude real) OWNER TO postgres;
    465 
    466 --
    467 -- Name: memory_asset_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    468 --
    469 
    470 -- CREATE FUNCTION memory_asset_delete_audit() RETURNS trigger
    471 --     LANGUAGE plpgsql
    472 --     AS $$
    473 --     BEGIN
    474 --       INSERT INTO memory_asset_audit ("memoryId", "assetId")
    475 --       SELECT "memoriesId", "assetId" FROM OLD
    476 --       WHERE "memoriesId" IN (SELECT "id" FROM memory WHERE "id" IN (SELECT "memoriesId" FROM OLD));
    477 --       RETURN NULL;
    478 --     END
    479 --   $$;
    480 
    481 
    482 -- ALTER FUNCTION memory_asset_delete_audit() OWNER TO postgres;
    483 
    484 --
    485 -- Name: memory_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    486 --
    487 
    488 -- CREATE FUNCTION memory_delete_audit() RETURNS trigger
    489 --     LANGUAGE plpgsql
    490 --     AS $$
    491 --     BEGIN
    492 --       INSERT INTO memory_audit ("memoryId", "userId")
    493 --       SELECT "id", "ownerId"
    494 --       FROM OLD;
    495 --       RETURN NULL;
    496 --     END
    497 --   $$;
    498 
    499 
    500 -- ALTER FUNCTION memory_delete_audit() OWNER TO postgres;
    501 
    502 --
    503 -- Name: partner_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    504 --
    505 
    506 -- CREATE FUNCTION partner_delete_audit() RETURNS trigger
    507 --     LANGUAGE plpgsql
    508 --     AS $$
    509 --     BEGIN
    510 --       INSERT INTO partner_audit ("sharedById", "sharedWithId")
    511 --       SELECT "sharedById", "sharedWithId"
    512 --       FROM OLD;
    513 --       RETURN NULL;
    514 --     END
    515 --   $$;
    516 
    517 
    518 -- ALTER FUNCTION partner_delete_audit() OWNER TO postgres;
    519 
    520 --
    521 -- Name: person_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    522 --
    523 
    524 -- CREATE FUNCTION person_delete_audit() RETURNS trigger
    525 --     LANGUAGE plpgsql
    526 --     AS $$
    527 --     BEGIN
    528 --       INSERT INTO person_audit ("personGroupId", "ownerId")
    529 --       SELECT "personGroupId", "ownerId"
    530 --       FROM OLD;
    531 --       RETURN NULL;
    532 --     END
    533 --   $$;
    534 
    535 
    536 -- ALTER FUNCTION person_delete_audit() OWNER TO postgres;
    537 
    538 --
    539 -- Name: person_group_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    540 --
    541 
    542 -- CREATE FUNCTION person_group_delete_audit() RETURNS trigger
    543 --     LANGUAGE plpgsql
    544 --     AS $$
    545 --     BEGIN
    546 --       INSERT INTO person_group_audit ("personGroupId", "clusterGroupId")
    547 --       SELECT "id", "clusterGroupId"
    548 --       FROM OLD;
    549 --       RETURN NULL;
    550 --     END
    551 --   $$;
    552 
    553 
    554 -- ALTER FUNCTION person_group_delete_audit() OWNER TO postgres;
    555 
    556 --
    557 -- Name: stack_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    558 --
    559 
    560 -- CREATE FUNCTION stack_delete_audit() RETURNS trigger
    561 --     LANGUAGE plpgsql
    562 --     AS $$
    563 --     BEGIN
    564 --       INSERT INTO stack_audit ("stackId", "userId")
    565 --       SELECT "id", "ownerId"
    566 --       FROM OLD;
    567 --       RETURN NULL;
    568 --     END
    569 --   $$;
    570 
    571 
    572 -- ALTER FUNCTION stack_delete_audit() OWNER TO postgres;
    573 
    574 --
    575 -- Name: updated_at(); Type: FUNCTION; Schema: public; Owner: postgres
    576 --
    577 
    578 -- CREATE FUNCTION updated_at() RETURNS trigger
    579 --     LANGUAGE plpgsql
    580 --     AS $$
    581 --     DECLARE
    582 --         clock_timestamp TIMESTAMP := current_timestamp;
    583 --     BEGIN
    584 --         new."updatedAt" = clock_timestamp;
    585 --         new."updateId" = immich_uuid_v7(clock_timestamp);
    586 --         return new;
    587 --     END;
    588 --   $$;
    589 
    590 
    591 -- ALTER FUNCTION updated_at() OWNER TO postgres;
    592 
    593 --
    594 -- Name: user_delete_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    595 --
    596 
    597 -- CREATE FUNCTION user_delete_audit() RETURNS trigger
    598 --     LANGUAGE plpgsql
    599 --     AS $$
    600 --     BEGIN
    601 --       INSERT INTO user_audit ("userId")
    602 --       SELECT "id"
    603 --       FROM OLD;
    604 --       RETURN NULL;
    605 --     END
    606 --   $$;
    607 
    608 
    609 -- ALTER FUNCTION user_delete_audit() OWNER TO postgres;
    610 
    611 --
    612 -- Name: user_metadata_audit(); Type: FUNCTION; Schema: public; Owner: postgres
    613 --
    614 
    615 -- CREATE FUNCTION user_metadata_audit() RETURNS trigger
    616 --     LANGUAGE plpgsql
    617 --     AS $$
    618 --     BEGIN
    619 --       INSERT INTO user_metadata_audit ("userId", "key")
    620 --       SELECT "userId", "key"
    621 --       FROM OLD;
    622 --       RETURN NULL;
    623 --     END
    624 --   $$;
    625 
    626 
    627 -- ALTER FUNCTION user_metadata_audit() OWNER TO postgres;
    628 
    629 -- SET default_tablespace = '';
    630 
    631 -- SET default_table_access_method = heap;
    632 
    633 --
    634 -- Name: activity; Type: TABLE; Schema: public; Owner: postgres
    635 --
    636 
    637 CREATE TABLE activity (
    638     id text NOT NULL, --  
    639     "createdAt" text DEFAULT current_timestamp NOT NULL,
    640     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    641     "albumId" text NOT NULL,
    642     "userId" text NOT NULL,
    643     "assetId" text,
    644     comment text,
    645     "isLiked" int DEFAULT false NOT NULL,
    646     "updateId" text NOT NULL, -- 
    647     CONSTRAINT activity_like_check CHECK ((((comment IS NULL) AND ("isLiked" = true)) OR ((comment IS NOT NULL) AND ("isLiked" = false))))
    648 ) STRICT;
    649 
    650 
    651 -- -- ALTER TABLE activity OWNER TO postgres;
    652 
    653 --
    654 -- Name: album; Type: TABLE; Schema: public; Owner: postgres
    655 --
    656 
    657 CREATE TABLE album (
    658     id text NOT NULL, -- 
    659     "albumName" text DEFAULT 'Untitled Album' NOT NULL,
    660     "createdAt" text DEFAULT current_timestamp NOT NULL,
    661     "albumThumbnailAssetId" text,
    662     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    663     description text,
    664     "deletedAt" text,
    665     "isActivityEnabled" int DEFAULT true NOT NULL,
    666     "order" text DEFAULT 'desc' NOT NULL,
    667     "updateId" text NOT NULL -- DEFAULT immich_uuid_v7()
    668 ) STRICT;
    669 
    670 
    671 -- -- ALTER TABLE album OWNER TO postgres;
    672 
    673 --
    674 -- Name: COLUMN album."albumThumbnailAssetId"; Type: COMMENT; Schema: public; Owner: postgres
    675 --
    676 
    677 -- COMMENT ON COLUMN album."albumThumbnailAssetId" IS 'Asset ID to be used as thumbnail';
    678 
    679 
    680 --
    681 -- Name: album_asset; Type: TABLE; Schema: public; Owner: postgres
    682 --
    683 
    684 CREATE TABLE album_asset (
    685     "albumId" text NOT NULL,
    686     "assetId" text NOT NULL,
    687     "createdAt" text DEFAULT current_timestamp NOT NULL,
    688     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    689     "updateId" text NOT NULL -- DEFAULT immich_uuid_v7()
    690 ) STRICT;
    691 
    692 
    693 -- -- ALTER TABLE album_asset OWNER TO postgres;
    694 
    695 --
    696 -- Name: album_asset_audit; Type: TABLE; Schema: public; Owner: postgres
    697 --
    698 
    699 CREATE TABLE album_asset_audit (
    700     id text NOT NULL, -- 
    701     "albumId" text NOT NULL,
    702     "assetId" text NOT NULL,
    703     "deletedAt" text DEFAULT current_timestamp NOT NULL
    704 ) STRICT;
    705 
    706 
    707 -- -- ALTER TABLE album_asset_audit OWNER TO postgres;
    708 
    709 --
    710 -- Name: album_audit; Type: TABLE; Schema: public; Owner: postgres
    711 --
    712 
    713 CREATE TABLE album_audit (
    714     id text NOT NULL, -- DEFAULT immich_uuid_v7()
    715     "albumId" text NOT NULL,
    716     "userId" text NOT NULL,
    717     "deletedAt" text DEFAULT current_timestamp NOT NULL
    718 ) STRICT;
    719 
    720 
    721 -- -- ALTER TABLE album_audit OWNER TO postgres;
    722 
    723 --
    724 -- Name: album_user; Type: TABLE; Schema: public; Owner: postgres
    725 --
    726 
    727 CREATE TABLE album_user (
    728     "albumId" text NOT NULL,
    729     "userId" text NOT NULL,
    730     role text DEFAULT 'editor' NOT NULL,
    731     "updateId" text NOT NULL, --  
    732     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    733     "createId" text NOT NULL, --  DEFAULT immich_uuid_v7()
    734     "createdAt" text DEFAULT current_timestamp NOT NULL,
    735     CONSTRAINT role_check CHECK (role = "editor" OR role = "owner" OR role = "viewer")
    736 ) STRICT;
    737 
    738 
    739 -- -- ALTER TABLE album_user OWNER TO postgres;
    740 
    741 --
    742 -- Name: album_user_audit; Type: TABLE; Schema: public; Owner: postgres
    743 --
    744 
    745 CREATE TABLE album_user_audit (
    746     id text NOT NULL, -- 
    747     "albumId" text NOT NULL,
    748     "userId" text NOT NULL,
    749     "deletedAt" text DEFAULT current_timestamp NOT NULL
    750 ) STRICT;
    751 
    752 
    753 -- -- ALTER TABLE album_user_audit OWNER TO postgres;
    754 
    755 --
    756 -- Name: api_key; Type: TABLE; Schema: public; Owner: postgres
    757 --
    758 
    759 CREATE TABLE api_key (
    760     name text NOT NULL,
    761     key blob NOT NULL,
    762     "userId" text NOT NULL,
    763     "createdAt" text DEFAULT current_timestamp NOT NULL,
    764     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    765     id text NOT NULL, --  
    766     permissions text NOT NULL,
    767     "updateId" text NOT NULL -- DEFAULT immich_uuid_v7()
    768 ) STRICT;
    769 
    770 
    771 -- -- ALTER TABLE api_key OWNER TO postgres;
    772 
    773 --
    774 -- Name: asset; Type: TABLE; Schema: public; Owner: postgres
    775 --
    776 
    777 CREATE TABLE asset (
    778     id text NOT NULL,
    779     "ownerId" text NOT NULL,
    780     type text NOT NULL,
    781     "originalPath" text NOT NULL,
    782     "fileCreatedAt" text NOT NULL,
    783     "fileModifiedAt" text NOT NULL,
    784     "isFavorite" int DEFAULT false NOT NULL,
    785     duration int,
    786     checksum blob NOT NULL,
    787     "livePhotoVideoId"  text,
    788     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    789     "createdAt" text DEFAULT current_timestamp NOT NULL,
    790     "originalFileName" text NOT NULL,
    791     thumbhash blob, 
    792     "isOffline" int DEFAULT false NOT NULL,
    793     "libraryId"  text,
    794     "isExternal" int DEFAULT false NOT NULL,
    795     "deletedAt" text,
    796     "localDateTime" text NOT NULL,
    797     "stackId"  text,
    798     "duplicateId"  text,
    799     status text DEFAULT 'active' NOT NULL,
    800     "updateId" text NOT NULL,
    801     visibility text DEFAULT 'timeline' NOT NULL,
    802     width int,
    803     height int,
    804     "isEdited" int DEFAULT false NOT NULL,
    805     "checksumAlgorithm" text NOT NULL,
    806     CONSTRAINT status_check CHECK (status = 'active' OR status = 'trashed' OR status = 'deleted'),
    807     CONSTRAINT visibility_check CHECK (visibility = 'archive' OR visibility = 'timeline' OR visibility = 'hidden' OR  visibility = 'locked'),
    808     CONSTRAINT "checksumAlgorithm_check" CHECK ("checksumAlgorithm" = 'sha1' OR "checksumAlgorithm" = 'sha1-path')
    809 ) STRICT;
    810 
    811 
    812 -- -- ALTER TABLE asset OWNER TO postgres;
    813 
    814 --
    815 -- Name: asset_audio; Type: TABLE; Schema: public; Owner: postgres
    816 --
    817 
    818 CREATE TABLE asset_audio (
    819     "assetId" text NOT NULL,
    820     bitrate integer NOT NULL,
    821     "index" int NOT NULL,
    822     profile int,
    823     "codecName" text NOT NULL
    824 ) STRICT;
    825 
    826 
    827 -- -- ALTER TABLE asset_audio OWNER TO postgres;
    828 
    829 --
    830 -- Name: asset_audit; Type: TABLE; Schema: public; Owner: postgres
    831 --
    832 
    833 CREATE TABLE asset_audit (
    834     id text NOT NULl,
    835     "assetId" text NOT NULL,
    836     "ownerId" text NOT NULL,
    837     "deletedAt" text DEFAULT current_timestamp NOT NULL
    838 ) STRICT;
    839 
    840 
    841 -- -- ALTER TABLE asset_audit OWNER TO postgres;
    842 
    843 --
    844 -- Name: asset_edit; Type: TABLE; Schema: public; Owner: postgres
    845 --
    846 
    847 CREATE TABLE asset_edit (
    848     id text  NOT NULL,
    849     "assetId" text NOT NULL,
    850     action text NOT NULL,
    851     parameters text NOT NULL,
    852     sequence integer NOT NULL,
    853     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    854     "updateId" text NOT NULL
    855 ) STRICT;
    856 
    857 
    858 -- -- ALTER TABLE asset_edit OWNER TO postgres;
    859 
    860 --
    861 -- Name: asset_edit_audit; Type: TABLE; Schema: public; Owner: postgres
    862 --
    863 
    864 CREATE TABLE asset_edit_audit (
    865     id text NOT NULl,
    866     "editId" text NOT NULL,
    867     "assetId" text NOT NULL,
    868     "deletedAt" text DEFAULT current_timestamp NOT NULL
    869 ) STRICT;
    870 
    871 
    872 -- -- ALTER TABLE asset_edit_audit OWNER TO postgres;
    873 
    874 --
    875 -- Name: asset_exif; Type: TABLE; Schema: public; Owner: postgres
    876 --
    877 
    878 CREATE TABLE asset_exif (
    879     "assetId" text NOT NULL,
    880     make text,
    881     model text,
    882     "exifImageWidth" int,
    883     "exifImageHeight" int,
    884     "fileSizeInByte" int,
    885     orientation text,
    886     "dateTimeOriginal" text,
    887     "modifyDate" text,
    888     "lensModel" text,
    889     "fNumber" real,
    890     "focalLength" real,
    891     iso int,
    892     latitude real,
    893     longitude real,
    894     city text,
    895     state text,
    896     country text,
    897     description text DEFAULT '' NOT NULL,
    898     fps real,
    899     "exposureTime" text,
    900     "livePhotoCID" text,
    901     "timeZone" text,
    902     "projectionType" text,
    903     "profileDescription" text,
    904     colorspace text,
    905     "bitsPerSample" int,
    906     "autoStackId" text,
    907     rating int,
    908     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    909     "updateId" text NOT NULl
    910     -- "lockedProperties" character varying[], -- new table asset_exif_locked_property
    911     --tags character varying[] -- new table asset_exif_tag
    912 ) STRICT;
    913 
    914 CREATE TABLE asset_exif_locked_property (
    915     "assetId" text not null REFERENCES asset_exif("assetId") ON DELETE CASCADE,
    916     property text NOT NULL
    917 ) STRICT;
    918 
    919 CREATE TABLE asset_exif_tag (
    920     "assetId" text not null REFERENCES asset_exif("assetId") ON DELETE CASCADE,
    921     tag text NOT NULL
    922 ) STRICT;
    923 
    924 
    925 -- ALTER TABLE asset_exif OWNER TO postgres;
    926 
    927 --
    928 -- Name: asset_face; Type: TABLE; Schema: public; Owner: postgres
    929 --
    930 
    931 CREATE TABLE asset_face (
    932     "assetId" text NOT NULL,
    933     "personGroupId"  text,
    934     "imageWidth" integer DEFAULT 0 NOT NULL,
    935     "imageHeight" integer DEFAULT 0 NOT NULL,
    936     "boundingBoxX1" integer DEFAULT 0 NOT NULL,
    937     "boundingBoxY1" integer DEFAULT 0 NOT NULL,
    938     "boundingBoxX2" integer DEFAULT 0 NOT NULL,
    939     "boundingBoxY2" integer DEFAULT 0 NOT NULL,
    940     id text  NOT NULL,
    941     "sourceType" text DEFAULT 'machine-learning' NOT NULL,
    942     "deletedAt" text,
    943     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    944     "updateId" text NOT NULl,
    945     "isVisible" int DEFAULT true NOT NULL,
    946     CONSTRAINT "sourceType_check" CHECK ("sourceType" = 'machine-learning' OR "sourceType" = 'exif' OR "sourceType" = 'manual')
    947 ) STRICT;
    948 
    949 
    950 -- ALTER TABLE asset_face OWNER TO postgres;
    951 
    952 --
    953 -- Name: asset_face_audit; Type: TABLE; Schema: public; Owner: postgres
    954 --
    955 
    956 CREATE TABLE asset_face_audit (
    957     id text NOT NULl,
    958     "assetFaceId" text NOT NULL,
    959     "assetId" text NOT NULL,
    960     "deletedAt" text DEFAULT current_timestamp NOT NULL
    961 ) STRICT;
    962 
    963 
    964 -- ALTER TABLE asset_face_audit OWNER TO postgres;
    965 
    966 --
    967 -- Name: asset_file; Type: TABLE; Schema: public; Owner: postgres
    968 --
    969 
    970 CREATE TABLE asset_file (
    971     id text  NOT NULL,
    972     "assetId" text NOT NULL,
    973     "createdAt" text DEFAULT current_timestamp NOT NULL,
    974     "updatedAt" text DEFAULT current_timestamp NOT NULL,
    975     type text NOT NULL,
    976     path text NOT NULL,
    977     "updateId" text NOT NULl,
    978     "isEdited" int DEFAULT false NOT NULL,
    979     "isProgressive" int DEFAULT false NOT NULL,
    980     "isTransparent" int DEFAULT false NOT NULL
    981 ) STRICT;
    982 
    983 
    984 -- ALTER TABLE asset_file OWNER TO postgres;
    985 
    986 --
    987 -- Name: asset_job_status; Type: TABLE; Schema: public; Owner: postgres
    988 --
    989 
    990 CREATE TABLE asset_job_status (
    991     "assetId" text NOT NULL,
    992     "facesRecognizedAt" text,
    993     "metadataExtractedAt" text,
    994     "duplicatesDetectedAt" text,
    995     "ocrAt" text
    996 ) STRICT;
    997 
    998 
    999 -- ALTER TABLE asset_job_status OWNER TO postgres;
   1000 
   1001 --
   1002 -- Name: asset_keyframe; Type: TABLE; Schema: public; Owner: postgres
   1003 --
   1004 
   1005 CREATE TABLE asset_keyframe (
   1006     "assetId" text NOT NULL,
   1007     -- pts integer[] NOT NULL, -- new table
   1008     -- "accDuration" integer[] NOT NULL,
   1009     -- "ownDuration" integer[] NOT NULL,
   1010     "totalDuration" integer NOT NULL,
   1011     "packetCount" integer NOT NULL,
   1012     "outputFrames" integer NOT NULL
   1013 ) STRICT;
   1014 
   1015 CREATE TABLE asset_keyframe_pt (
   1016     "assetId" text NOT NULL REFERENCES asset_keyframe("assetId") ON DELETE CASCADE,
   1017     pt int NOT NULL,
   1018     ordinal int NOT NULL
   1019 ) STRICT;
   1020 CREATE TABLE "asset_keyframe_accDuration" (
   1021     "assetId" text NOT NULL REFERENCES asset_keyframe("assetId") ON DELETE CASCADE,
   1022     "accDuration" int NOT NULL,
   1023     ordinal int NOT NULL
   1024 ) STRICT;
   1025 CREATE TABLE "asset_keyframe_ownDuration" (
   1026     "assetId" text NOT NULL REFERENCES asset_keyframe("assetId") ON DELETE CASCADE,
   1027     "ownDuration" int NOT NULL,
   1028     ordinal int NOT NULL
   1029 ) STRICT;
   1030 
   1031 -- ALTER TABLE asset_keyframe OWNER TO postgres;
   1032 
   1033 --
   1034 -- Name: asset_metadata; Type: TABLE; Schema: public; Owner: postgres
   1035 --
   1036 
   1037 CREATE TABLE asset_metadata (
   1038     "assetId" text NOT NULL,
   1039     key text NOT NULL,
   1040     value text NOT NULL,
   1041     "updateId" text NOT NULl,
   1042     "updatedAt" text DEFAULT current_timestamp NOT NULL
   1043 ) STRICT;
   1044 
   1045 
   1046 -- ALTER TABLE asset_metadata OWNER TO postgres;
   1047 
   1048 --
   1049 -- Name: asset_metadata_audit; Type: TABLE; Schema: public; Owner: postgres
   1050 --
   1051 
   1052 CREATE TABLE asset_metadata_audit (
   1053     id text NOT NULl,
   1054     "assetId" text NOT NULL,
   1055     key text NOT NULL,
   1056     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1057 ) STRICT;
   1058 
   1059 
   1060 -- ALTER TABLE asset_metadata_audit OWNER TO postgres;
   1061 
   1062 --
   1063 -- Name: asset_ocr; Type: TABLE; Schema: public; Owner: postgres
   1064 --
   1065 
   1066 CREATE TABLE asset_ocr (
   1067     id text  NOT NULL,
   1068     "assetId" text NOT NULL,
   1069     x1 real NOT NULL,
   1070     y1 real NOT NULL,
   1071     x2 real NOT NULL,
   1072     y2 real NOT NULL,
   1073     x3 real NOT NULL,
   1074     y3 real NOT NULL,
   1075     x4 real NOT NULL,
   1076     y4 real NOT NULL,
   1077     "boxScore" real NOT NULL,
   1078     "textScore" real NOT NULL,
   1079     text text NOT NULL,
   1080     "isVisible" int DEFAULT true NOT NULL,
   1081     "updateId" text NOT NULl,
   1082     "updatedAt" text DEFAULT current_timestamp NOT NULL
   1083 ) STRICT;
   1084 
   1085 
   1086 -- ALTER TABLE asset_ocr OWNER TO postgres;
   1087 
   1088 --
   1089 -- Name: asset_ocr_audit; Type: TABLE; Schema: public; Owner: postgres
   1090 --
   1091 
   1092 CREATE TABLE asset_ocr_audit (
   1093     id text NOT NULl,
   1094     "assetId" text NOT NULL,
   1095     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1096 ) STRICT;
   1097 
   1098 
   1099 -- ALTER TABLE asset_ocr_audit OWNER TO postgres;
   1100 
   1101 --
   1102 -- Name: asset_video; Type: TABLE; Schema: public; Owner: postgres
   1103 --
   1104 
   1105 CREATE TABLE asset_video (
   1106     "assetId" text NOT NULL,
   1107     bitrate integer NOT NULL,
   1108     "frameCount" integer NOT NULL,
   1109     "timeBase" integer NOT NULL,
   1110     "index" int NOT NULL,
   1111     profile int,
   1112     level int,
   1113     "colorPrimaries" int NOT NULL,
   1114     "colorTransfer" int NOT NULL,
   1115     "colorMatrix" int NOT NULL,
   1116     "dvProfile" int,
   1117     "dvLevel" int,
   1118     "dvBlSignalCompatibilityId" int,
   1119     "codecName" text NOT NULL,
   1120     "formatName" text NOT NULL,
   1121     "formatLongName" text NOT NULL,
   1122     "pixelFormat" text NOT NULL
   1123 ) STRICT;
   1124 
   1125 
   1126 -- ALTER TABLE asset_video OWNER TO postgres;
   1127 
   1128 --
   1129 -- Name: cluster_group; Type: TABLE; Schema: public; Owner: postgres
   1130 --
   1131 
   1132 CREATE TABLE cluster_group (
   1133     id text  NOT NULL,
   1134     name text,
   1135     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1136     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1137     "updateId" text NOT NULL
   1138 ) STRICT;
   1139 
   1140 
   1141 -- ALTER TABLE cluster_group OWNER TO postgres;
   1142 
   1143 --
   1144 -- Name: cluster_group_request; Type: TABLE; Schema: public; Owner: postgres
   1145 --
   1146 
   1147 CREATE TABLE cluster_group_request (
   1148     id text  NOT NULL,
   1149     "clusterGroupId" text NOT NULL,
   1150     "userId" text NOT NULL,
   1151     "createdAt" text DEFAULT current_timestamp NOT NULL
   1152 ) STRICT;
   1153 
   1154 
   1155 -- -- ALTER TABLE cluster_group_request OWNER TO postgres;
   1156 
   1157 --
   1158 -- Name: face_search; Type: TABLE; Schema: public; Owner: postgres
   1159 --
   1160 
   1161 CREATE TABLE face_search (
   1162     "faceId" text NOT NULL,
   1163     embedding vector(512) NOT NULL
   1164 ) STRICT;
   1165 
   1166 
   1167 -- -- ALTER TABLE face_search OWNER TO postgres;
   1168 
   1169 --
   1170 -- Name: geodata_places; Type: TABLE; Schema: public; Owner: postgres
   1171 --
   1172 
   1173 CREATE TABLE geodata_places (
   1174     id integer NOT NULL,
   1175     name character varying(200) NOT NULL,
   1176     longitude real NOT NULL,
   1177     latitude real NOT NULL,
   1178     "countryCode" character(2) NOT NULL,
   1179     "admin1Code" character varying(20),
   1180     "admin2Code" character varying(80),
   1181     "modificationDate" date NOT NULL,
   1182     "admin1Name" text,
   1183     "admin2Name" text,
   1184     "alternateNames" character varying
   1185 ) STRICT;
   1186 
   1187 
   1188 -- ALTER TABLE geodata_places OWNER TO postgres;
   1189 
   1190 --
   1191 -- Name: integrity_report; Type: TABLE; Schema: public; Owner: postgres
   1192 --
   1193 
   1194 CREATE TABLE integrity_report (
   1195     id text NOT NULl,
   1196     type text NOT NULL,
   1197     path text NOT NULL,
   1198     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1199     "assetId"  text,
   1200     "fileAssetId" uuid
   1201 ) STRICT;
   1202 
   1203 
   1204 -- ALTER TABLE integrity_report OWNER TO postgres;
   1205 
   1206 --
   1207 -- Name: kysely_migrations; Type: TABLE; Schema: public; Owner: postgres
   1208 --
   1209 
   1210 CREATE TABLE kysely_migrations (
   1211     name character varying(255) NOT NULL,
   1212     "timestamp" character varying(255) NOT NULL
   1213 ) STRICT;
   1214 
   1215 
   1216 -- ALTER TABLE kysely_migrations OWNER TO postgres;
   1217 
   1218 --
   1219 -- Name: kysely_migrations_lock; Type: TABLE; Schema: public; Owner: postgres
   1220 --
   1221 
   1222 CREATE TABLE kysely_migrations_lock (
   1223     id character varying(255) NOT NULL,
   1224     is_locked integer DEFAULT 0 NOT NULL
   1225 ) STRICT;
   1226 
   1227 
   1228 -- ALTER TABLE kysely_migrations_lock OWNER TO postgres;
   1229 
   1230 --
   1231 -- Name: library; Type: TABLE; Schema: public; Owner: postgres
   1232 --
   1233 
   1234 CREATE TABLE library (
   1235     id text  NOT NULL,
   1236     name text NOT NULL,
   1237     "ownerId" text NOT NULL,
   1238     "importPaths" text[] NOT NULL,
   1239     "exclusionPatterns" text[] NOT NULL,
   1240     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1241     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1242     "deletedAt" text,
   1243     "refreshedAt" text,
   1244     "updateId" text NOT NULL
   1245 ) STRICT;
   1246 
   1247 
   1248 -- ALTER TABLE library OWNER TO postgres;
   1249 
   1250 --
   1251 -- Name: memory; Type: TABLE; Schema: public; Owner: postgres
   1252 --
   1253 
   1254 CREATE TABLE memory (
   1255     id text  NOT NULL,
   1256     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1257     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1258     "deletedAt" text,
   1259     "ownerId" text NOT NULL,
   1260     type text NOT NULL,
   1261     data text NOT NULL,
   1262     "isSaved" int DEFAULT false NOT NULL,
   1263     "memoryAt" text NOT NULL,
   1264     "seenAt" text,
   1265     "showAt" text,
   1266     "hideAt" text,
   1267     "updateId" text NOT NULL
   1268 ) STRICT;
   1269 
   1270 
   1271 -- ALTER TABLE memory OWNER TO postgres;
   1272 
   1273 --
   1274 -- Name: memory_asset; Type: TABLE; Schema: public; Owner: postgres
   1275 --
   1276 
   1277 CREATE TABLE memory_asset (
   1278     "memoriesId" text NOT NULL,
   1279     "assetId" text NOT NULL,
   1280     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1281     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1282     "updateId" text NOT NULL
   1283 ) STRICT;
   1284 
   1285 
   1286 -- ALTER TABLE memory_asset OWNER TO postgres;
   1287 
   1288 --
   1289 -- Name: memory_asset_audit; Type: TABLE; Schema: public; Owner: postgres
   1290 --
   1291 
   1292 CREATE TABLE memory_asset_audit (
   1293     id text NOT NULl,
   1294     "memoryId" text NOT NULL,
   1295     "assetId" text NOT NULL,
   1296     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1297 ) STRICT;
   1298 
   1299 
   1300 -- ALTER TABLE memory_asset_audit OWNER TO postgres;
   1301 
   1302 --
   1303 -- Name: memory_audit; Type: TABLE; Schema: public; Owner: postgres
   1304 --
   1305 
   1306 CREATE TABLE memory_audit (
   1307     id text NOT NULl,
   1308     "memoryId" text NOT NULL,
   1309     "userId" text NOT NULL,
   1310     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1311 ) STRICT;
   1312 
   1313 
   1314 -- ALTER TABLE memory_audit OWNER TO postgres;
   1315 
   1316 --
   1317 -- Name: migration_overrides; Type: TABLE; Schema: public; Owner: postgres
   1318 --
   1319 
   1320 CREATE TABLE migration_overrides (
   1321     name text NOT NULL,
   1322     value text NOT NULL
   1323 ) STRICT;
   1324 
   1325 
   1326 -- ALTER TABLE migration_overrides OWNER TO postgres;
   1327 
   1328 --
   1329 -- Name: move_history; Type: TABLE; Schema: public; Owner: postgres
   1330 --
   1331 
   1332 CREATE TABLE move_history (
   1333     id text  NOT NULL,
   1334     "entityId" text NOT NULL,
   1335     "pathType" text NOT NULL,
   1336     "oldPath" text NOT NULL,
   1337     "newPath" text NOT NULL
   1338 ) STRICT;
   1339 
   1340 
   1341 -- ALTER TABLE move_history OWNER TO postgres;
   1342 
   1343 --
   1344 -- Name: naturalearth_countries; Type: TABLE; Schema: public; Owner: postgres
   1345 --
   1346 
   1347 CREATE TABLE naturalearth_countries (
   1348     id integer primary key NOT NULL,
   1349     admin character varying(50) NOT NULL,
   1350     admin_a3 character varying(3) NOT NULL,
   1351     type character varying(50) NOT NULL,
   1352     coordinates polygon NOT NULL
   1353 ) STRICT;
   1354 
   1355 
   1356 -- ALTER TABLE naturalearth_countries OWNER TO postgres;
   1357 
   1358 --
   1359 -- Name: naturalearth_countries_tmp_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
   1360 --
   1361 
   1362 -- ALTER TABLE naturalearth_countries ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
   1363 --     SEQUENCE NAME naturalearth_countries_tmp_id_seq
   1364 --     START WITH 1
   1365 --     INCREMENT BY 1
   1366 --     NO MINVALUE
   1367 --     MAXVALUE 2147483647
   1368 --     CACHE 1
   1369 -- );
   1370 
   1371 
   1372 --
   1373 -- Name: notification; Type: TABLE; Schema: public; Owner: postgres
   1374 --
   1375 
   1376 CREATE TABLE notification (
   1377     id text  NOT NULL,
   1378     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1379     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1380     "deletedAt" text,
   1381     "updateId" text NOT NULl,
   1382     "userId"  text,
   1383     level text DEFAULT 'info'::character varying NOT NULL,
   1384     type text DEFAULT 'info'::character varying NOT NULL,
   1385     data jsonb,
   1386     title text NOT NULL,
   1387     description text,
   1388     "readAt" text
   1389 ) STRICT;
   1390 
   1391 
   1392 -- ALTER TABLE notification OWNER TO postgres;
   1393 
   1394 --
   1395 -- Name: ocr_search; Type: TABLE; Schema: public; Owner: postgres
   1396 --
   1397 
   1398 CREATE TABLE ocr_search (
   1399     "assetId" text NOT NULL,
   1400     text text NOT NULL
   1401 ) STRICT;
   1402 
   1403 
   1404 -- ALTER TABLE ocr_search OWNER TO postgres;
   1405 
   1406 --
   1407 -- Name: partner; Type: TABLE; Schema: public; Owner: postgres
   1408 --
   1409 
   1410 CREATE TABLE partner (
   1411     "sharedById" text NOT NULL,
   1412     "sharedWithId" text NOT NULL,
   1413     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1414     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1415     "inTimeline" int DEFAULT false NOT NULL,
   1416     "updateId" text NOT NULl,
   1417     "createId" text NOT NULL
   1418 ) STRICT;
   1419 
   1420 
   1421 -- ALTER TABLE partner OWNER TO postgres;
   1422 
   1423 --
   1424 -- Name: partner_audit; Type: TABLE; Schema: public; Owner: postgres
   1425 --
   1426 
   1427 CREATE TABLE partner_audit (
   1428     id text NOT NULl,
   1429     "sharedById" text NOT NULL,
   1430     "sharedWithId" text NOT NULL,
   1431     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1432 ) STRICT;
   1433 
   1434 
   1435 -- ALTER TABLE partner_audit OWNER TO postgres;
   1436 
   1437 --
   1438 -- Name: person; Type: TABLE; Schema: public; Owner: postgres
   1439 --
   1440 
   1441 CREATE TABLE person (
   1442     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1443     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1444     "ownerId" text NOT NULL,
   1445     name text DEFAULT '' NOT NULL,
   1446     "thumbnailPath" text DEFAULT '' NOT NULL,
   1447     "isHidden" int DEFAULT false NOT NULL,
   1448     "birthDate" date,
   1449     "faceAssetId"  text,
   1450     "isFavorite" int DEFAULT false NOT NULL,
   1451     color text,
   1452     "updateId" text NOT NULl,
   1453     "personGroupId" text NOT NULL,
   1454     CONSTRAINT "person_birthDate_chk" CHECK (("birthDate" <= CURRENT_DATE))
   1455 ) STRICT;
   1456 
   1457 
   1458 -- ALTER TABLE person OWNER TO postgres;
   1459 
   1460 --
   1461 -- Name: person_audit; Type: TABLE; Schema: public; Owner: postgres
   1462 --
   1463 
   1464 CREATE TABLE person_audit (
   1465     id text NOT NULl,
   1466     "ownerId" text NOT NULL,
   1467     "deletedAt" text DEFAULT current_timestamp NOT NULL,
   1468     "personGroupId" text NOT NULL
   1469 ) STRICT;
   1470 
   1471 
   1472 -- ALTER TABLE person_audit OWNER TO postgres;
   1473 
   1474 --
   1475 -- Name: person_group; Type: TABLE; Schema: public; Owner: postgres
   1476 --
   1477 
   1478 CREATE TABLE person_group (
   1479     id text  NOT NULL,
   1480     "clusterGroupId" text NOT NULL,
   1481     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1482     "createId" text NOT NULl,
   1483     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1484     "updateId" text NOT NULL
   1485 ) STRICT;
   1486 
   1487 
   1488 -- ALTER TABLE person_group OWNER TO postgres;
   1489 
   1490 --
   1491 -- Name: person_group_audit; Type: TABLE; Schema: public; Owner: postgres
   1492 --
   1493 
   1494 CREATE TABLE person_group_audit (
   1495     id text NOT NULl,
   1496     "personGroupId" text NOT NULL,
   1497     "clusterGroupId" text NOT NULL,
   1498     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1499 ) STRICT;
   1500 
   1501 
   1502 -- ALTER TABLE person_group_audit OWNER TO postgres;
   1503 
   1504 --
   1505 -- Name: plugin; Type: TABLE; Schema: public; Owner: postgres
   1506 --
   1507 
   1508 CREATE TABLE plugin (
   1509     id text  NOT NULL,
   1510     enabled int DEFAULT true NOT NULL,
   1511     name text NOT NULL,
   1512     version text NOT NULL,
   1513     title text NOT NULL,
   1514     description text NOT NULL,
   1515     author text NOT NULL,
   1516     "wasmBytes" blob NOT NULL,
   1517     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1518     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1519     templates text NOT NULL,
   1520     sha256hash blob NOT NULL
   1521 ) STRICT;
   1522 
   1523 
   1524 -- ALTER TABLE plugin OWNER TO postgres;
   1525 
   1526 --
   1527 -- Name: plugin_method; Type: TABLE; Schema: public; Owner: postgres
   1528 --
   1529 
   1530 CREATE TABLE plugin_method (
   1531     id text  NOT NULL,
   1532     "pluginId" text NOT NULL,
   1533     name text NOT NULL,
   1534     title text NOT NULL,
   1535     description text NOT NULL,
   1536     types character varying[] NOT NULL,
   1537     "hostFunctions" int DEFAULT false NOT NULL,
   1538     "uiHints" character varying[] DEFAULT '{}'::character varying[] NOT NULL,
   1539     schema jsonb,
   1540     "allowedHosts" character varying[] DEFAULT '{}'::character varying[] NOT NULL
   1541 ) STRICT;
   1542 
   1543 
   1544 -- ALTER TABLE plugin_method OWNER TO postgres;
   1545 
   1546 --
   1547 -- Name: session; Type: TABLE; Schema: public; Owner: postgres
   1548 --
   1549 
   1550 CREATE TABLE session (
   1551     id text  NOT NULL,
   1552     token blob NOT NULL,
   1553     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1554     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1555     "userId" text NOT NULL,
   1556     "deviceType" text DEFAULT '' NOT NULL,
   1557     "deviceOS" text DEFAULT '' NOT NULL,
   1558     "updateId" text NOT NULl,
   1559     "pinExpiresAt" text,
   1560     "expiresAt" text,
   1561     "parentId"  text,
   1562     "isPendingSyncReset" int DEFAULT false NOT NULL,
   1563     "appVersion" text,
   1564     "oauthSid" text,
   1565     "oauthBearerToken" character varying
   1566 ) STRICT;
   1567 
   1568 
   1569 -- ALTER TABLE session OWNER TO postgres;
   1570 
   1571 --
   1572 -- Name: session_sync_checkpoint; Type: TABLE; Schema: public; Owner: postgres
   1573 --
   1574 
   1575 CREATE TABLE session_sync_checkpoint (
   1576     "sessionId" text NOT NULL,
   1577     type text NOT NULL,
   1578     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1579     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1580     ack text NOT NULL,
   1581     "updateId" text NOT NULL
   1582 ) STRICT;
   1583 
   1584 
   1585 -- ALTER TABLE session_sync_checkpoint OWNER TO postgres;
   1586 
   1587 --
   1588 -- Name: shared_link; Type: TABLE; Schema: public; Owner: postgres
   1589 --
   1590 
   1591 CREATE TABLE shared_link (
   1592     id text  NOT NULL,
   1593     description text,
   1594     "userId" text NOT NULL,
   1595     key blob NOT NULL,
   1596     type text NOT NULL,
   1597     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1598     "expiresAt" text,
   1599     "allowUpload" int DEFAULT false NOT NULL,
   1600     "albumId"  text,
   1601     "allowDownload" int DEFAULT true NOT NULL,
   1602     "showExif" int DEFAULT true NOT NULL,
   1603     password text,
   1604     slug character varying
   1605 ) STRICT;
   1606 
   1607 
   1608 -- ALTER TABLE shared_link OWNER TO postgres;
   1609 
   1610 --
   1611 -- Name: shared_link_asset; Type: TABLE; Schema: public; Owner: postgres
   1612 --
   1613 
   1614 CREATE TABLE shared_link_asset (
   1615     "assetId" text NOT NULL,
   1616     "sharedLinkId" text NOT NULL
   1617 ) STRICT;
   1618 
   1619 
   1620 -- ALTER TABLE shared_link_asset OWNER TO postgres;
   1621 
   1622 --
   1623 -- Name: smart_search; Type: TABLE; Schema: public; Owner: postgres
   1624 --
   1625 
   1626 CREATE TABLE smart_search (
   1627     "assetId" text NOT NULL,
   1628     embedding vector(512) NOT NULL
   1629 ) STRICT;
   1630 
   1631 
   1632 -- ALTER TABLE smart_search OWNER TO postgres;
   1633 
   1634 --
   1635 -- Name: stack; Type: TABLE; Schema: public; Owner: postgres
   1636 --
   1637 
   1638 CREATE TABLE stack (
   1639     id text  NOT NULL,
   1640     "primaryAssetId" text NOT NULL,
   1641     "ownerId" text NOT NULL,
   1642     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1643     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1644     "updateId" text NOT NULL
   1645 ) STRICT;
   1646 
   1647 
   1648 -- ALTER TABLE stack OWNER TO postgres;
   1649 
   1650 --
   1651 -- Name: stack_audit; Type: TABLE; Schema: public; Owner: postgres
   1652 --
   1653 
   1654 CREATE TABLE stack_audit (
   1655     id text NOT NULl,
   1656     "stackId" text NOT NULL,
   1657     "userId" text NOT NULL,
   1658     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1659 ) STRICT;
   1660 
   1661 
   1662 -- ALTER TABLE stack_audit OWNER TO postgres;
   1663 
   1664 --
   1665 -- Name: system_metadata; Type: TABLE; Schema: public; Owner: postgres
   1666 --
   1667 
   1668 CREATE TABLE system_metadata (
   1669     key text NOT NULL,
   1670     value text NOT NULL
   1671 ) STRICT;
   1672 
   1673 
   1674 -- ALTER TABLE system_metadata OWNER TO postgres;
   1675 
   1676 --
   1677 -- Name: tag; Type: TABLE; Schema: public; Owner: postgres
   1678 --
   1679 
   1680 CREATE TABLE tag (
   1681     id text  NOT NULL,
   1682     "userId" text NOT NULL,
   1683     value text NOT NULL,
   1684     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1685     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1686     color text,
   1687     "parentId"  text,
   1688     "updateId" text NOT NULL
   1689 ) STRICT;
   1690 
   1691 
   1692 -- ALTER TABLE tag OWNER TO postgres;
   1693 
   1694 --
   1695 -- Name: tag_asset; Type: TABLE; Schema: public; Owner: postgres
   1696 --
   1697 
   1698 CREATE TABLE tag_asset (
   1699     "assetId" text NOT NULL,
   1700     "tagId" text NOT NULL
   1701 ) STRICT;
   1702 
   1703 
   1704 -- ALTER TABLE tag_asset OWNER TO postgres;
   1705 
   1706 --
   1707 -- Name: tag_closure; Type: TABLE; Schema: public; Owner: postgres
   1708 --
   1709 
   1710 CREATE TABLE tag_closure (
   1711     id_ancestor text NOT NULL,
   1712     id_descendant text NOT NULL
   1713 ) STRICT;
   1714 
   1715 
   1716 -- ALTER TABLE tag_closure OWNER TO postgres;
   1717 
   1718 --
   1719 -- Name: user; Type: TABLE; Schema: public; Owner: postgres
   1720 --
   1721 
   1722 CREATE TABLE "user" (
   1723     id text NOT NULL,
   1724     email text NOT NULL,
   1725     password text,
   1726     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1727     "profileImagePath" text DEFAULT '' NOT NULL,
   1728     "isAdmin" int DEFAULT false NOT NULL,
   1729     "shouldChangePassword" int DEFAULT true NOT NULL,
   1730     "deletedAt" text,
   1731     "oauthId" text DEFAULT '' NOT NULL,
   1732     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1733     "storageLabel" text,
   1734     name text DEFAULT '' NOT NULL,
   1735     "quotaSizeInBytes" int,
   1736     "quotaUsageInBytes" bigint DEFAULT 0 NOT NULL,
   1737     status text DEFAULT 'active' NOT NULL,
   1738     "profileChangedAt" text DEFAULT current_timestamp NOT NULL,
   1739     "updateId" text NOT NULl,
   1740     "avatarColor" text,
   1741     "pinCode" text,
   1742     "clusterGroupId" text NOT NULL
   1743 ) STRICT;
   1744 
   1745 
   1746 -- ALTER TABLE "user" OWNER TO postgres;
   1747 
   1748 --
   1749 -- Name: user_audit; Type: TABLE; Schema: public; Owner: postgres
   1750 --
   1751 
   1752 CREATE TABLE user_audit (
   1753     "userId" text NOT NULL,
   1754     "deletedAt" text DEFAULT current_timestamp NOT NULL,
   1755     id text NOT NULL
   1756 ) STRICT;
   1757 
   1758 
   1759 -- ALTER TABLE user_audit OWNER TO postgres;
   1760 
   1761 --
   1762 -- Name: user_metadata; Type: TABLE; Schema: public; Owner: postgres
   1763 --
   1764 
   1765 CREATE TABLE user_metadata (
   1766     "userId" text NOT NULL,
   1767     key text NOT NULL,
   1768     value text NOT NULL,
   1769     "updateId" text NOT NULl,
   1770     "updatedAt" text DEFAULT current_timestamp NOT NULL
   1771 ) STRICT;
   1772 
   1773 
   1774 -- ALTER TABLE user_metadata OWNER TO postgres;
   1775 
   1776 --
   1777 -- Name: user_metadata_audit; Type: TABLE; Schema: public; Owner: postgres
   1778 --
   1779 
   1780 CREATE TABLE user_metadata_audit (
   1781     id text NOT NULl,
   1782     "userId" text NOT NULL,
   1783     key text NOT NULL,
   1784     "deletedAt" text DEFAULT current_timestamp NOT NULL
   1785 ) STRICT;
   1786 
   1787 
   1788 -- ALTER TABLE user_metadata_audit OWNER TO postgres;
   1789 
   1790 --
   1791 -- Name: version_history; Type: TABLE; Schema: public; Owner: postgres
   1792 --
   1793 
   1794 CREATE TABLE version_history (
   1795     id text  NOT NULL,
   1796     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1797     version text NOT NULL
   1798 ) STRICT;
   1799 
   1800 
   1801 -- ALTER TABLE version_history OWNER TO postgres;
   1802 
   1803 --
   1804 -- Name: video_stream_segment; Type: TABLE; Schema: public; Owner: postgres
   1805 --
   1806 
   1807 CREATE TABLE video_stream_segment (
   1808     "variantId" text NOT NULL,
   1809     index integer NOT NULL,
   1810     "durationUs" integer NOT NULL
   1811 ) STRICT;
   1812 
   1813 
   1814 -- ALTER TABLE video_stream_segment OWNER TO postgres;
   1815 
   1816 --
   1817 -- Name: video_stream_session; Type: TABLE; Schema: public; Owner: postgres
   1818 --
   1819 
   1820 CREATE TABLE video_stream_session (
   1821     id text  NOT NULL,
   1822     "assetId" text NOT NULL,
   1823     "expiresAt" text NOT NULL,
   1824     "createdAt" text DEFAULT current_timestamp NOT NULL
   1825 ) STRICT;
   1826 
   1827 
   1828 -- ALTER TABLE video_stream_session OWNER TO postgres;
   1829 
   1830 --
   1831 -- Name: video_stream_variant; Type: TABLE; Schema: public; Owner: postgres
   1832 --
   1833 
   1834 CREATE TABLE video_stream_variant (
   1835     id text  NOT NULL,
   1836     "sessionId" text NOT NULL,
   1837     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1838     bitrate integer NOT NULL,
   1839     codec video_stream_variant_codec_enum NOT NULL,
   1840     resolution int NOT NULL
   1841 ) STRICT;
   1842 
   1843 
   1844 -- ALTER TABLE video_stream_variant OWNER TO postgres;
   1845 
   1846 --
   1847 -- Name: workflow; Type: TABLE; Schema: public; Owner: postgres
   1848 --
   1849 
   1850 CREATE TABLE workflow (
   1851     id text  NOT NULL,
   1852     "ownerId" text NOT NULL,
   1853     trigger text NOT NULL,
   1854     name text,
   1855     description text,
   1856     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1857     "updatedAt" text DEFAULT current_timestamp NOT NULL,
   1858     "updateId" text NOT NULl,
   1859     enabled int DEFAULT true NOT NULL,
   1860     logging int DEFAULT false NOT NULL
   1861 ) STRICT;
   1862 
   1863 
   1864 -- ALTER TABLE workflow OWNER TO postgres;
   1865 
   1866 --
   1867 -- Name: workflow_log; Type: TABLE; Schema: public; Owner: postgres
   1868 --
   1869 
   1870 CREATE TABLE workflow_log (
   1871     id text  NOT NULL,
   1872     "createdAt" text DEFAULT current_timestamp NOT NULL,
   1873     "workflowId" text NOT NULL,
   1874     result text NOT NULL,
   1875     "workflowStepId"  text,
   1876     "triggerDataId"  text,
   1877     "runId" text NOT NULL
   1878 ) STRICT;
   1879 
   1880 
   1881 -- ALTER TABLE workflow_log OWNER TO postgres;
   1882 
   1883 --
   1884 -- Name: workflow_step; Type: TABLE; Schema: public; Owner: postgres
   1885 --
   1886 
   1887 CREATE TABLE workflow_step (
   1888     id text  NOT NULL,
   1889     enabled int DEFAULT true NOT NULL,
   1890     "workflowId" text NOT NULL,
   1891     "pluginMethodId" text NOT NULL,
   1892     config jsonb,
   1893     "order" integer NOT NULL
   1894 ) STRICT;
   1895 
   1896 
   1897 -- ALTER TABLE workflow_step OWNER TO postgres;
   1898 
   1899 --
   1900 -- Name: move_history UQ_entityId_pathType; Type: CONSTRAINT; Schema: public; Owner: postgres
   1901 --
   1902 
   1903 ALTER TABLE ONLY move_history
   1904     ADD CONSTRAINT "UQ_entityId_pathType" UNIQUE ("entityId", "pathType");
   1905 
   1906 
   1907 --
   1908 -- Name: move_history UQ_newPath; Type: CONSTRAINT; Schema: public; Owner: postgres
   1909 --
   1910 
   1911 ALTER TABLE ONLY move_history
   1912     ADD CONSTRAINT "UQ_newPath" UNIQUE ("newPath");
   1913 
   1914 
   1915 --
   1916 -- Name: activity activity_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1917 --
   1918 
   1919 ALTER TABLE ONLY activity
   1920     ADD CONSTRAINT activity_pkey PRIMARY KEY (id);
   1921 
   1922 
   1923 --
   1924 -- Name: album_asset_audit album_asset_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1925 --
   1926 
   1927 ALTER TABLE ONLY album_asset_audit
   1928     ADD CONSTRAINT album_asset_audit_pkey PRIMARY KEY (id);
   1929 
   1930 
   1931 --
   1932 -- Name: album_asset album_asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1933 --
   1934 
   1935 ALTER TABLE ONLY album_asset
   1936     ADD CONSTRAINT album_asset_pkey PRIMARY KEY ("albumId", "assetId");
   1937 
   1938 
   1939 --
   1940 -- Name: album_audit album_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1941 --
   1942 
   1943 ALTER TABLE ONLY album_audit
   1944     ADD CONSTRAINT album_audit_pkey PRIMARY KEY (id);
   1945 
   1946 
   1947 --
   1948 -- Name: album album_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1949 --
   1950 
   1951 ALTER TABLE ONLY album
   1952     ADD CONSTRAINT album_pkey PRIMARY KEY (id);
   1953 
   1954 
   1955 --
   1956 -- Name: album_user_audit album_user_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1957 --
   1958 
   1959 ALTER TABLE ONLY album_user_audit
   1960     ADD CONSTRAINT album_user_audit_pkey PRIMARY KEY (id);
   1961 
   1962 
   1963 --
   1964 -- Name: album_user album_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1965 --
   1966 
   1967 ALTER TABLE ONLY album_user
   1968     ADD CONSTRAINT album_user_pkey PRIMARY KEY ("albumId", "userId");
   1969 
   1970 
   1971 --
   1972 -- Name: api_key api_key_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1973 --
   1974 
   1975 ALTER TABLE ONLY api_key
   1976     ADD CONSTRAINT api_key_pkey PRIMARY KEY (id);
   1977 
   1978 
   1979 --
   1980 -- Name: asset_audio asset_audio_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1981 --
   1982 
   1983 ALTER TABLE ONLY asset_audio
   1984     ADD CONSTRAINT asset_audio_pkey PRIMARY KEY ("assetId");
   1985 
   1986 
   1987 --
   1988 -- Name: asset_audit asset_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   1989 --
   1990 
   1991 ALTER TABLE ONLY asset_audit
   1992     ADD CONSTRAINT asset_audit_pkey PRIMARY KEY (id);
   1993 
   1994 
   1995 --
   1996 -- Name: asset_edit asset_edit_assetId_sequence_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   1997 --
   1998 
   1999 ALTER TABLE ONLY asset_edit
   2000     ADD CONSTRAINT "asset_edit_assetId_sequence_uq" UNIQUE ("assetId", sequence);
   2001 
   2002 
   2003 --
   2004 -- Name: asset_edit_audit asset_edit_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2005 --
   2006 
   2007 ALTER TABLE ONLY asset_edit_audit
   2008     ADD CONSTRAINT asset_edit_audit_pkey PRIMARY KEY (id);
   2009 
   2010 
   2011 --
   2012 -- Name: asset_edit asset_edit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2013 --
   2014 
   2015 ALTER TABLE ONLY asset_edit
   2016     ADD CONSTRAINT asset_edit_pkey PRIMARY KEY (id);
   2017 
   2018 
   2019 --
   2020 -- Name: asset_exif asset_exif_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2021 --
   2022 
   2023 ALTER TABLE ONLY asset_exif
   2024     ADD CONSTRAINT asset_exif_pkey PRIMARY KEY ("assetId");
   2025 
   2026 
   2027 --
   2028 -- Name: asset_face_audit asset_face_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2029 --
   2030 
   2031 ALTER TABLE ONLY asset_face_audit
   2032     ADD CONSTRAINT asset_face_audit_pkey PRIMARY KEY (id);
   2033 
   2034 
   2035 --
   2036 -- Name: asset_face asset_face_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2037 --
   2038 
   2039 ALTER TABLE ONLY asset_face
   2040     ADD CONSTRAINT asset_face_pkey PRIMARY KEY (id);
   2041 
   2042 
   2043 --
   2044 -- Name: asset_file asset_file_assetId_type_isEdited_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2045 --
   2046 
   2047 ALTER TABLE ONLY asset_file
   2048     ADD CONSTRAINT "asset_file_assetId_type_isEdited_uq" UNIQUE ("assetId", type, "isEdited");
   2049 
   2050 
   2051 --
   2052 -- Name: asset_file asset_file_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2053 --
   2054 
   2055 ALTER TABLE ONLY asset_file
   2056     ADD CONSTRAINT asset_file_pkey PRIMARY KEY (id);
   2057 
   2058 
   2059 --
   2060 -- Name: asset_job_status asset_job_status_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2061 --
   2062 
   2063 ALTER TABLE ONLY asset_job_status
   2064     ADD CONSTRAINT asset_job_status_pkey PRIMARY KEY ("assetId");
   2065 
   2066 
   2067 --
   2068 -- Name: asset_keyframe asset_keyframe_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2069 --
   2070 
   2071 ALTER TABLE ONLY asset_keyframe
   2072     ADD CONSTRAINT asset_keyframe_pkey PRIMARY KEY ("assetId");
   2073 
   2074 
   2075 --
   2076 -- Name: asset_metadata_audit asset_metadata_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2077 --
   2078 
   2079 ALTER TABLE ONLY asset_metadata_audit
   2080     ADD CONSTRAINT asset_metadata_audit_pkey PRIMARY KEY (id);
   2081 
   2082 
   2083 --
   2084 -- Name: asset_metadata asset_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2085 --
   2086 
   2087 ALTER TABLE ONLY asset_metadata
   2088     ADD CONSTRAINT asset_metadata_pkey PRIMARY KEY ("assetId", key);
   2089 
   2090 
   2091 --
   2092 -- Name: asset_ocr_audit asset_ocr_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2093 --
   2094 
   2095 ALTER TABLE ONLY asset_ocr_audit
   2096     ADD CONSTRAINT asset_ocr_audit_pkey PRIMARY KEY (id);
   2097 
   2098 
   2099 --
   2100 -- Name: asset_ocr asset_ocr_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2101 --
   2102 
   2103 ALTER TABLE ONLY asset_ocr
   2104     ADD CONSTRAINT asset_ocr_pkey PRIMARY KEY (id);
   2105 
   2106 
   2107 --
   2108 -- Name: asset asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2109 --
   2110 
   2111 ALTER TABLE ONLY asset
   2112     ADD CONSTRAINT asset_pkey PRIMARY KEY (id);
   2113 
   2114 
   2115 --
   2116 -- Name: asset_video asset_video_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2117 --
   2118 
   2119 ALTER TABLE ONLY asset_video
   2120     ADD CONSTRAINT asset_video_pkey PRIMARY KEY ("assetId");
   2121 
   2122 
   2123 --
   2124 -- Name: cluster_group cluster_group_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2125 --
   2126 
   2127 ALTER TABLE ONLY cluster_group
   2128     ADD CONSTRAINT cluster_group_pkey PRIMARY KEY (id);
   2129 
   2130 
   2131 --
   2132 -- Name: cluster_group_request cluster_group_request_clusterGroupId_userId_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2133 --
   2134 
   2135 ALTER TABLE ONLY cluster_group_request
   2136     ADD CONSTRAINT "cluster_group_request_clusterGroupId_userId_uq" UNIQUE ("clusterGroupId", "userId");
   2137 
   2138 
   2139 --
   2140 -- Name: cluster_group_request cluster_group_request_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2141 --
   2142 
   2143 ALTER TABLE ONLY cluster_group_request
   2144     ADD CONSTRAINT cluster_group_request_pkey PRIMARY KEY (id);
   2145 
   2146 
   2147 --
   2148 -- Name: face_search face_search_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2149 --
   2150 
   2151 ALTER TABLE ONLY face_search
   2152     ADD CONSTRAINT face_search_pkey PRIMARY KEY ("faceId");
   2153 
   2154 
   2155 --
   2156 -- Name: geodata_places geodata_places_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2157 --
   2158 
   2159 ALTER TABLE ONLY geodata_places
   2160     ADD CONSTRAINT geodata_places_pkey PRIMARY KEY (id) WITH (fillfactor='100');
   2161 
   2162 
   2163 --
   2164 -- Name: integrity_report integrity_report_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2165 --
   2166 
   2167 ALTER TABLE ONLY integrity_report
   2168     ADD CONSTRAINT integrity_report_pkey PRIMARY KEY (id);
   2169 
   2170 
   2171 --
   2172 -- Name: integrity_report integrity_report_type_path_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2173 --
   2174 
   2175 ALTER TABLE ONLY integrity_report
   2176     ADD CONSTRAINT integrity_report_type_path_uq UNIQUE (type, path);
   2177 
   2178 
   2179 --
   2180 -- Name: kysely_migrations_lock kysely_migrations_lock_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2181 --
   2182 
   2183 ALTER TABLE ONLY kysely_migrations_lock
   2184     ADD CONSTRAINT kysely_migrations_lock_pkey PRIMARY KEY (id);
   2185 
   2186 
   2187 --
   2188 -- Name: kysely_migrations kysely_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2189 --
   2190 
   2191 ALTER TABLE ONLY kysely_migrations
   2192     ADD CONSTRAINT kysely_migrations_pkey PRIMARY KEY (name);
   2193 
   2194 
   2195 --
   2196 -- Name: library library_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2197 --
   2198 
   2199 ALTER TABLE ONLY library
   2200     ADD CONSTRAINT library_pkey PRIMARY KEY (id);
   2201 
   2202 
   2203 --
   2204 -- Name: memory_asset_audit memory_asset_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2205 --
   2206 
   2207 ALTER TABLE ONLY memory_asset_audit
   2208     ADD CONSTRAINT memory_asset_audit_pkey PRIMARY KEY (id);
   2209 
   2210 
   2211 --
   2212 -- Name: memory_asset memory_asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2213 --
   2214 
   2215 ALTER TABLE ONLY memory_asset
   2216     ADD CONSTRAINT memory_asset_pkey PRIMARY KEY ("memoriesId", "assetId");
   2217 
   2218 
   2219 --
   2220 -- Name: memory_audit memory_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2221 --
   2222 
   2223 ALTER TABLE ONLY memory_audit
   2224     ADD CONSTRAINT memory_audit_pkey PRIMARY KEY (id);
   2225 
   2226 
   2227 --
   2228 -- Name: memory memory_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2229 --
   2230 
   2231 ALTER TABLE ONLY memory
   2232     ADD CONSTRAINT memory_pkey PRIMARY KEY (id);
   2233 
   2234 
   2235 --
   2236 -- Name: migration_overrides migration_overrides_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2237 --
   2238 
   2239 ALTER TABLE ONLY migration_overrides
   2240     ADD CONSTRAINT migration_overrides_pkey PRIMARY KEY (name);
   2241 
   2242 
   2243 --
   2244 -- Name: move_history move_history_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2245 --
   2246 
   2247 ALTER TABLE ONLY move_history
   2248     ADD CONSTRAINT move_history_pkey PRIMARY KEY (id);
   2249 
   2250 
   2251 --
   2252 -- Name: naturalearth_countries naturalearth_countries_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2253 --
   2254 
   2255 ALTER TABLE ONLY naturalearth_countries
   2256     ADD CONSTRAINT naturalearth_countries_pkey PRIMARY KEY (id) WITH (fillfactor='100');
   2257 
   2258 
   2259 --
   2260 -- Name: notification notification_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2261 --
   2262 
   2263 ALTER TABLE ONLY notification
   2264     ADD CONSTRAINT notification_pkey PRIMARY KEY (id);
   2265 
   2266 
   2267 --
   2268 -- Name: ocr_search ocr_search_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2269 --
   2270 
   2271 ALTER TABLE ONLY ocr_search
   2272     ADD CONSTRAINT ocr_search_pkey PRIMARY KEY ("assetId");
   2273 
   2274 
   2275 --
   2276 -- Name: partner_audit partner_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2277 --
   2278 
   2279 ALTER TABLE ONLY partner_audit
   2280     ADD CONSTRAINT partner_audit_pkey PRIMARY KEY (id);
   2281 
   2282 
   2283 --
   2284 -- Name: partner partner_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2285 --
   2286 
   2287 ALTER TABLE ONLY partner
   2288     ADD CONSTRAINT partner_pkey PRIMARY KEY ("sharedById", "sharedWithId");
   2289 
   2290 
   2291 --
   2292 -- Name: person_audit person_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2293 --
   2294 
   2295 ALTER TABLE ONLY person_audit
   2296     ADD CONSTRAINT person_audit_pkey PRIMARY KEY (id);
   2297 
   2298 
   2299 --
   2300 -- Name: person_group_audit person_group_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2301 --
   2302 
   2303 ALTER TABLE ONLY person_group_audit
   2304     ADD CONSTRAINT person_group_audit_pkey PRIMARY KEY (id);
   2305 
   2306 
   2307 --
   2308 -- Name: person_group person_group_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2309 --
   2310 
   2311 ALTER TABLE ONLY person_group
   2312     ADD CONSTRAINT person_group_pkey PRIMARY KEY (id);
   2313 
   2314 
   2315 --
   2316 -- Name: person person_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2317 --
   2318 
   2319 ALTER TABLE ONLY person
   2320     ADD CONSTRAINT person_pkey PRIMARY KEY ("ownerId", "personGroupId");
   2321 
   2322 
   2323 --
   2324 -- Name: plugin_method plugin_method_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2325 --
   2326 
   2327 ALTER TABLE ONLY plugin_method
   2328     ADD CONSTRAINT plugin_method_pkey PRIMARY KEY (id);
   2329 
   2330 
   2331 --
   2332 -- Name: plugin_method plugin_method_pluginId_name_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2333 --
   2334 
   2335 ALTER TABLE ONLY plugin_method
   2336     ADD CONSTRAINT "plugin_method_pluginId_name_uq" UNIQUE ("pluginId", name);
   2337 
   2338 
   2339 --
   2340 -- Name: plugin plugin_name_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2341 --
   2342 
   2343 ALTER TABLE ONLY plugin
   2344     ADD CONSTRAINT plugin_name_uq UNIQUE (name);
   2345 
   2346 
   2347 --
   2348 -- Name: plugin plugin_name_version_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2349 --
   2350 
   2351 ALTER TABLE ONLY plugin
   2352     ADD CONSTRAINT plugin_name_version_uq UNIQUE (name, version);
   2353 
   2354 
   2355 --
   2356 -- Name: plugin plugin_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2357 --
   2358 
   2359 ALTER TABLE ONLY plugin
   2360     ADD CONSTRAINT plugin_pkey PRIMARY KEY (id);
   2361 
   2362 
   2363 --
   2364 -- Name: session session_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2365 --
   2366 
   2367 ALTER TABLE ONLY session
   2368     ADD CONSTRAINT session_pkey PRIMARY KEY (id);
   2369 
   2370 
   2371 --
   2372 -- Name: session_sync_checkpoint session_sync_checkpoint_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2373 --
   2374 
   2375 ALTER TABLE ONLY session_sync_checkpoint
   2376     ADD CONSTRAINT session_sync_checkpoint_pkey PRIMARY KEY ("sessionId", type);
   2377 
   2378 
   2379 --
   2380 -- Name: shared_link_asset shared_link_asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2381 --
   2382 
   2383 ALTER TABLE ONLY shared_link_asset
   2384     ADD CONSTRAINT shared_link_asset_pkey PRIMARY KEY ("assetId", "sharedLinkId");
   2385 
   2386 
   2387 --
   2388 -- Name: shared_link shared_link_key_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2389 --
   2390 
   2391 ALTER TABLE ONLY shared_link
   2392     ADD CONSTRAINT shared_link_key_uq UNIQUE (key);
   2393 
   2394 
   2395 --
   2396 -- Name: shared_link shared_link_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2397 --
   2398 
   2399 ALTER TABLE ONLY shared_link
   2400     ADD CONSTRAINT shared_link_pkey PRIMARY KEY (id);
   2401 
   2402 
   2403 --
   2404 -- Name: shared_link shared_link_slug_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2405 --
   2406 
   2407 ALTER TABLE ONLY shared_link
   2408     ADD CONSTRAINT shared_link_slug_uq UNIQUE (slug);
   2409 
   2410 
   2411 --
   2412 -- Name: smart_search smart_search_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2413 --
   2414 
   2415 ALTER TABLE ONLY smart_search
   2416     ADD CONSTRAINT smart_search_pkey PRIMARY KEY ("assetId");
   2417 
   2418 
   2419 --
   2420 -- Name: stack_audit stack_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2421 --
   2422 
   2423 ALTER TABLE ONLY stack_audit
   2424     ADD CONSTRAINT stack_audit_pkey PRIMARY KEY (id);
   2425 
   2426 
   2427 --
   2428 -- Name: stack stack_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2429 --
   2430 
   2431 ALTER TABLE ONLY stack
   2432     ADD CONSTRAINT stack_pkey PRIMARY KEY (id);
   2433 
   2434 
   2435 --
   2436 -- Name: stack stack_primaryAssetId_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2437 --
   2438 
   2439 ALTER TABLE ONLY stack
   2440     ADD CONSTRAINT "stack_primaryAssetId_uq" UNIQUE ("primaryAssetId");
   2441 
   2442 
   2443 --
   2444 -- Name: system_metadata system_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2445 --
   2446 
   2447 ALTER TABLE ONLY system_metadata
   2448     ADD CONSTRAINT system_metadata_pkey PRIMARY KEY (key);
   2449 
   2450 
   2451 --
   2452 -- Name: tag_asset tag_asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2453 --
   2454 
   2455 ALTER TABLE ONLY tag_asset
   2456     ADD CONSTRAINT tag_asset_pkey PRIMARY KEY ("assetId", "tagId");
   2457 
   2458 
   2459 --
   2460 -- Name: tag_closure tag_closure_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2461 --
   2462 
   2463 ALTER TABLE ONLY tag_closure
   2464     ADD CONSTRAINT tag_closure_pkey PRIMARY KEY (id_ancestor, id_descendant);
   2465 
   2466 
   2467 --
   2468 -- Name: tag tag_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2469 --
   2470 
   2471 ALTER TABLE ONLY tag
   2472     ADD CONSTRAINT tag_pkey PRIMARY KEY (id);
   2473 
   2474 
   2475 --
   2476 -- Name: tag tag_userId_value_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2477 --
   2478 
   2479 ALTER TABLE ONLY tag
   2480     ADD CONSTRAINT "tag_userId_value_uq" UNIQUE ("userId", value);
   2481 
   2482 
   2483 --
   2484 -- Name: user_audit user_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2485 --
   2486 
   2487 ALTER TABLE ONLY user_audit
   2488     ADD CONSTRAINT user_audit_pkey PRIMARY KEY (id);
   2489 
   2490 
   2491 --
   2492 -- Name: user user_email_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2493 --
   2494 
   2495 ALTER TABLE ONLY "user"
   2496     ADD CONSTRAINT user_email_uq UNIQUE (email);
   2497 
   2498 
   2499 --
   2500 -- Name: user_metadata_audit user_metadata_audit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2501 --
   2502 
   2503 ALTER TABLE ONLY user_metadata_audit
   2504     ADD CONSTRAINT user_metadata_audit_pkey PRIMARY KEY (id);
   2505 
   2506 
   2507 --
   2508 -- Name: user_metadata user_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2509 --
   2510 
   2511 ALTER TABLE ONLY user_metadata
   2512     ADD CONSTRAINT user_metadata_pkey PRIMARY KEY ("userId", key);
   2513 
   2514 
   2515 --
   2516 -- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2517 --
   2518 
   2519 ALTER TABLE ONLY "user"
   2520     ADD CONSTRAINT user_pkey PRIMARY KEY (id);
   2521 
   2522 
   2523 --
   2524 -- Name: user user_storageLabel_uq; Type: CONSTRAINT; Schema: public; Owner: postgres
   2525 --
   2526 
   2527 ALTER TABLE ONLY "user"
   2528     ADD CONSTRAINT "user_storageLabel_uq" UNIQUE ("storageLabel");
   2529 
   2530 
   2531 --
   2532 -- Name: version_history version_history_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2533 --
   2534 
   2535 ALTER TABLE ONLY version_history
   2536     ADD CONSTRAINT version_history_pkey PRIMARY KEY (id);
   2537 
   2538 
   2539 --
   2540 -- Name: video_stream_segment video_stream_segment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2541 --
   2542 
   2543 ALTER TABLE ONLY video_stream_segment
   2544     ADD CONSTRAINT video_stream_segment_pkey PRIMARY KEY ("variantId", index);
   2545 
   2546 
   2547 --
   2548 -- Name: video_stream_session video_stream_session_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2549 --
   2550 
   2551 ALTER TABLE ONLY video_stream_session
   2552     ADD CONSTRAINT video_stream_session_pkey PRIMARY KEY (id);
   2553 
   2554 
   2555 --
   2556 -- Name: video_stream_variant video_stream_variant_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2557 --
   2558 
   2559 ALTER TABLE ONLY video_stream_variant
   2560     ADD CONSTRAINT video_stream_variant_pkey PRIMARY KEY (id);
   2561 
   2562 
   2563 --
   2564 -- Name: workflow_log workflow_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2565 --
   2566 
   2567 ALTER TABLE ONLY workflow_log
   2568     ADD CONSTRAINT workflow_log_pkey PRIMARY KEY (id);
   2569 
   2570 
   2571 --
   2572 -- Name: workflow workflow_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2573 --
   2574 
   2575 ALTER TABLE ONLY workflow
   2576     ADD CONSTRAINT workflow_pkey PRIMARY KEY (id);
   2577 
   2578 
   2579 --
   2580 -- Name: workflow_step workflow_step_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
   2581 --
   2582 
   2583 ALTER TABLE ONLY workflow_step
   2584     ADD CONSTRAINT workflow_step_pkey PRIMARY KEY (id);
   2585 
   2586 
   2587 --
   2588 -- Name: IDX_asset_exif_gist_earthcoord; Type: INDEX; Schema: public; Owner: postgres
   2589 --
   2590 
   2591 CREATE INDEX "IDX_asset_exif_gist_earthcoord" ON asset_exif USING gist (public.ll_to_earth_public(latitude, longitude));
   2592 
   2593 
   2594 --
   2595 -- Name: IDX_geodata_gist_earthcoord; Type: INDEX; Schema: public; Owner: postgres
   2596 --
   2597 
   2598 CREATE INDEX "IDX_geodata_gist_earthcoord" ON geodata_places USING gist (public.ll_to_earth_public(latitude, longitude));
   2599 
   2600 
   2601 --
   2602 -- Name: IDX_user_metadata_audit_deleted_at; Type: INDEX; Schema: public; Owner: postgres
   2603 --
   2604 
   2605 CREATE INDEX "IDX_user_metadata_audit_deleted_at" ON user_metadata_audit USING btree ("deletedAt");
   2606 
   2607 
   2608 --
   2609 -- Name: IDX_user_metadata_audit_key; Type: INDEX; Schema: public; Owner: postgres
   2610 --
   2611 
   2612 CREATE INDEX "IDX_user_metadata_audit_key" ON user_metadata_audit USING btree (key);
   2613 
   2614 
   2615 --
   2616 -- Name: IDX_user_metadata_audit_user_id; Type: INDEX; Schema: public; Owner: postgres
   2617 --
   2618 
   2619 CREATE INDEX "IDX_user_metadata_audit_user_id" ON user_metadata_audit USING btree ("userId");
   2620 
   2621 
   2622 --
   2623 -- Name: IDX_user_metadata_update_id; Type: INDEX; Schema: public; Owner: postgres
   2624 --
   2625 
   2626 CREATE INDEX "IDX_user_metadata_update_id" ON user_metadata USING btree ("updateId");
   2627 
   2628 
   2629 --
   2630 -- Name: IDX_user_metadata_updated_at; Type: INDEX; Schema: public; Owner: postgres
   2631 --
   2632 
   2633 CREATE INDEX "IDX_user_metadata_updated_at" ON user_metadata USING btree ("updatedAt");
   2634 
   2635 
   2636 --
   2637 -- Name: UQ_assets_owner_checksum; Type: INDEX; Schema: public; Owner: postgres
   2638 --
   2639 
   2640 CREATE UNIQUE INDEX "UQ_assets_owner_checksum" ON asset USING btree ("ownerId", checksum) WHERE ("libraryId" IS NULL);
   2641 
   2642 
   2643 --
   2644 -- Name: activity_albumId_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2645 --
   2646 
   2647 CREATE INDEX "activity_albumId_assetId_idx" ON activity USING btree ("albumId", "assetId");
   2648 
   2649 
   2650 --
   2651 -- Name: activity_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2652 --
   2653 
   2654 CREATE INDEX "activity_albumId_idx" ON activity USING btree ("albumId");
   2655 
   2656 
   2657 --
   2658 -- Name: activity_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2659 --
   2660 
   2661 CREATE INDEX "activity_assetId_idx" ON activity USING btree ("assetId");
   2662 
   2663 
   2664 --
   2665 -- Name: activity_like_idx; Type: INDEX; Schema: public; Owner: postgres
   2666 --
   2667 
   2668 CREATE UNIQUE INDEX activity_like_idx ON activity USING btree ("assetId", "userId", "albumId") WHERE ("isLiked" = true);
   2669 
   2670 
   2671 --
   2672 -- Name: activity_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2673 --
   2674 
   2675 CREATE INDEX "activity_updateId_idx" ON activity USING btree ("updateId");
   2676 
   2677 
   2678 --
   2679 -- Name: activity_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   2680 --
   2681 
   2682 CREATE INDEX "activity_userId_idx" ON activity USING btree ("userId");
   2683 
   2684 
   2685 --
   2686 -- Name: album_albumThumbnailAssetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2687 --
   2688 
   2689 CREATE INDEX "album_albumThumbnailAssetId_idx" ON album USING btree ("albumThumbnailAssetId");
   2690 
   2691 
   2692 --
   2693 -- Name: album_asset_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2694 --
   2695 
   2696 CREATE INDEX "album_asset_albumId_idx" ON album_asset USING btree ("albumId");
   2697 
   2698 
   2699 --
   2700 -- Name: album_asset_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2701 --
   2702 
   2703 CREATE INDEX "album_asset_assetId_idx" ON album_asset USING btree ("assetId");
   2704 
   2705 
   2706 --
   2707 -- Name: album_asset_audit_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2708 --
   2709 
   2710 CREATE INDEX "album_asset_audit_albumId_idx" ON album_asset_audit USING btree ("albumId");
   2711 
   2712 
   2713 --
   2714 -- Name: album_asset_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2715 --
   2716 
   2717 CREATE INDEX "album_asset_audit_assetId_idx" ON album_asset_audit USING btree ("assetId");
   2718 
   2719 
   2720 --
   2721 -- Name: album_asset_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2722 --
   2723 
   2724 CREATE INDEX "album_asset_audit_deletedAt_idx" ON album_asset_audit USING btree ("deletedAt");
   2725 
   2726 
   2727 --
   2728 -- Name: album_asset_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2729 --
   2730 
   2731 CREATE INDEX "album_asset_updateId_idx" ON album_asset USING btree ("updateId");
   2732 
   2733 
   2734 --
   2735 -- Name: album_audit_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2736 --
   2737 
   2738 CREATE INDEX "album_audit_albumId_idx" ON album_audit USING btree ("albumId");
   2739 
   2740 
   2741 --
   2742 -- Name: album_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2743 --
   2744 
   2745 CREATE INDEX "album_audit_deletedAt_idx" ON album_audit USING btree ("deletedAt");
   2746 
   2747 
   2748 --
   2749 -- Name: album_audit_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   2750 --
   2751 
   2752 CREATE INDEX "album_audit_userId_idx" ON album_audit USING btree ("userId");
   2753 
   2754 
   2755 --
   2756 -- Name: album_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2757 --
   2758 
   2759 CREATE INDEX "album_updateId_idx" ON album USING btree ("updateId");
   2760 
   2761 
   2762 --
   2763 -- Name: album_user_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2764 --
   2765 
   2766 CREATE INDEX "album_user_albumId_idx" ON album_user USING btree ("albumId");
   2767 
   2768 
   2769 --
   2770 -- Name: album_user_audit_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   2771 --
   2772 
   2773 CREATE INDEX "album_user_audit_albumId_idx" ON album_user_audit USING btree ("albumId");
   2774 
   2775 
   2776 --
   2777 -- Name: album_user_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2778 --
   2779 
   2780 CREATE INDEX "album_user_audit_deletedAt_idx" ON album_user_audit USING btree ("deletedAt");
   2781 
   2782 
   2783 --
   2784 -- Name: album_user_audit_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   2785 --
   2786 
   2787 CREATE INDEX "album_user_audit_userId_idx" ON album_user_audit USING btree ("userId");
   2788 
   2789 
   2790 --
   2791 -- Name: album_user_createId_idx; Type: INDEX; Schema: public; Owner: postgres
   2792 --
   2793 
   2794 CREATE INDEX "album_user_createId_idx" ON album_user USING btree ("createId");
   2795 
   2796 
   2797 --
   2798 -- Name: album_user_unique_owner; Type: INDEX; Schema: public; Owner: postgres
   2799 --
   2800 
   2801 CREATE UNIQUE INDEX album_user_unique_owner ON album_user USING btree ("albumId") WHERE (role = 'owner'::public.album_user_role_enum);
   2802 
   2803 
   2804 --
   2805 -- Name: album_user_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2806 --
   2807 
   2808 CREATE INDEX "album_user_updateId_idx" ON album_user USING btree ("updateId");
   2809 
   2810 
   2811 --
   2812 -- Name: album_user_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   2813 --
   2814 
   2815 CREATE INDEX "album_user_userId_idx" ON album_user USING btree ("userId");
   2816 
   2817 
   2818 --
   2819 -- Name: api_key_key_idx; Type: INDEX; Schema: public; Owner: postgres
   2820 --
   2821 
   2822 CREATE INDEX api_key_key_idx ON api_key USING btree (key);
   2823 
   2824 
   2825 --
   2826 -- Name: api_key_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2827 --
   2828 
   2829 CREATE INDEX "api_key_updateId_idx" ON api_key USING btree ("updateId");
   2830 
   2831 
   2832 --
   2833 -- Name: api_key_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   2834 --
   2835 
   2836 CREATE INDEX "api_key_userId_idx" ON api_key USING btree ("userId");
   2837 
   2838 
   2839 --
   2840 -- Name: asset_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2841 --
   2842 
   2843 CREATE INDEX "asset_audit_assetId_idx" ON asset_audit USING btree ("assetId");
   2844 
   2845 
   2846 --
   2847 -- Name: asset_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2848 --
   2849 
   2850 CREATE INDEX "asset_audit_deletedAt_idx" ON asset_audit USING btree ("deletedAt");
   2851 
   2852 
   2853 --
   2854 -- Name: asset_audit_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   2855 --
   2856 
   2857 CREATE INDEX "asset_audit_ownerId_idx" ON asset_audit USING btree ("ownerId");
   2858 
   2859 
   2860 --
   2861 -- Name: asset_checksum_idx; Type: INDEX; Schema: public; Owner: postgres
   2862 --
   2863 
   2864 CREATE INDEX asset_checksum_idx ON asset USING btree (checksum);
   2865 
   2866 
   2867 --
   2868 -- Name: asset_createdAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2869 --
   2870 
   2871 CREATE INDEX "asset_createdAt_idx" ON asset USING btree ("createdAt");
   2872 
   2873 
   2874 --
   2875 -- Name: asset_duplicateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2876 --
   2877 
   2878 CREATE INDEX "asset_duplicateId_idx" ON asset USING btree ("duplicateId");
   2879 
   2880 
   2881 --
   2882 -- Name: asset_edit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2883 --
   2884 
   2885 CREATE INDEX "asset_edit_assetId_idx" ON asset_edit USING btree ("assetId");
   2886 
   2887 
   2888 --
   2889 -- Name: asset_edit_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2890 --
   2891 
   2892 CREATE INDEX "asset_edit_audit_assetId_idx" ON asset_edit_audit USING btree ("assetId");
   2893 
   2894 
   2895 --
   2896 -- Name: asset_edit_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2897 --
   2898 
   2899 CREATE INDEX "asset_edit_audit_deletedAt_idx" ON asset_edit_audit USING btree ("deletedAt");
   2900 
   2901 
   2902 --
   2903 -- Name: asset_edit_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2904 --
   2905 
   2906 CREATE INDEX "asset_edit_updateId_idx" ON asset_edit USING btree ("updateId");
   2907 
   2908 
   2909 --
   2910 -- Name: asset_exif_autoStackId_idx; Type: INDEX; Schema: public; Owner: postgres
   2911 --
   2912 
   2913 CREATE INDEX "asset_exif_autoStackId_idx" ON asset_exif USING btree ("autoStackId");
   2914 
   2915 
   2916 --
   2917 -- Name: asset_exif_city_idx; Type: INDEX; Schema: public; Owner: postgres
   2918 --
   2919 
   2920 CREATE INDEX asset_exif_city_idx ON asset_exif USING btree (city);
   2921 
   2922 
   2923 --
   2924 -- Name: asset_exif_livePhotoCID_idx; Type: INDEX; Schema: public; Owner: postgres
   2925 --
   2926 
   2927 CREATE INDEX "asset_exif_livePhotoCID_idx" ON asset_exif USING btree ("livePhotoCID");
   2928 
   2929 
   2930 --
   2931 -- Name: asset_exif_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2932 --
   2933 
   2934 CREATE INDEX "asset_exif_updateId_idx" ON asset_exif USING btree ("updateId");
   2935 
   2936 
   2937 --
   2938 -- Name: asset_face_assetId_personGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   2939 --
   2940 
   2941 CREATE INDEX "asset_face_assetId_personGroupId_idx" ON asset_face USING btree ("assetId", "personGroupId");
   2942 
   2943 
   2944 --
   2945 -- Name: asset_face_audit_assetFaceId_idx; Type: INDEX; Schema: public; Owner: postgres
   2946 --
   2947 
   2948 CREATE INDEX "asset_face_audit_assetFaceId_idx" ON asset_face_audit USING btree ("assetFaceId");
   2949 
   2950 
   2951 --
   2952 -- Name: asset_face_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2953 --
   2954 
   2955 CREATE INDEX "asset_face_audit_assetId_idx" ON asset_face_audit USING btree ("assetId");
   2956 
   2957 
   2958 --
   2959 -- Name: asset_face_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2960 --
   2961 
   2962 CREATE INDEX "asset_face_audit_deletedAt_idx" ON asset_face_audit USING btree ("deletedAt");
   2963 
   2964 
   2965 --
   2966 -- Name: asset_face_personGroupId_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2967 --
   2968 
   2969 CREATE INDEX "asset_face_personGroupId_assetId_idx" ON asset_face USING btree ("personGroupId", "assetId");
   2970 
   2971 
   2972 --
   2973 -- Name: asset_face_personGroupId_assetId_notDeleted_isVisible_idx; Type: INDEX; Schema: public; Owner: postgres
   2974 --
   2975 
   2976 CREATE INDEX "asset_face_personGroupId_assetId_notDeleted_isVisible_idx" ON asset_face USING btree ("personGroupId", "assetId") WHERE (("deletedAt" IS NULL) AND ("isVisible" IS TRUE));
   2977 
   2978 
   2979 --
   2980 -- Name: asset_fileCreatedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   2981 --
   2982 
   2983 CREATE INDEX "asset_fileCreatedAt_idx" ON asset USING btree ("fileCreatedAt");
   2984 
   2985 
   2986 --
   2987 -- Name: asset_file_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   2988 --
   2989 
   2990 CREATE INDEX "asset_file_assetId_idx" ON asset_file USING btree ("assetId");
   2991 
   2992 
   2993 --
   2994 -- Name: asset_file_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   2995 --
   2996 
   2997 CREATE INDEX "asset_file_updateId_idx" ON asset_file USING btree ("updateId");
   2998 
   2999 
   3000 --
   3001 -- Name: asset_id_stackId_idx; Type: INDEX; Schema: public; Owner: postgres
   3002 --
   3003 
   3004 CREATE INDEX "asset_id_stackId_idx" ON asset USING btree (id, "stackId");
   3005 
   3006 
   3007 --
   3008 -- Name: asset_id_timeline_notDeleted_idx; Type: INDEX; Schema: public; Owner: postgres
   3009 --
   3010 
   3011 CREATE INDEX "asset_id_timeline_notDeleted_idx" ON asset USING btree (id) WHERE ((visibility = 'timeline'::public.asset_visibility_enum) AND ("deletedAt" IS NULL));
   3012 
   3013 
   3014 --
   3015 -- Name: asset_libraryId_idx; Type: INDEX; Schema: public; Owner: postgres
   3016 --
   3017 
   3018 CREATE INDEX "asset_libraryId_idx" ON asset USING btree ("libraryId");
   3019 
   3020 
   3021 --
   3022 -- Name: asset_livePhotoVideoId_idx; Type: INDEX; Schema: public; Owner: postgres
   3023 --
   3024 
   3025 CREATE INDEX "asset_livePhotoVideoId_idx" ON asset USING btree ("livePhotoVideoId");
   3026 
   3027 
   3028 --
   3029 -- Name: asset_localDateTime_idx; Type: INDEX; Schema: public; Owner: postgres
   3030 --
   3031 
   3032 CREATE INDEX "asset_localDateTime_idx" ON asset USING btree (((("localDateTime" AT TIME ZONE 'UTC'::text))::date));
   3033 
   3034 
   3035 --
   3036 -- Name: asset_localDateTime_month_idx; Type: INDEX; Schema: public; Owner: postgres
   3037 --
   3038 
   3039 CREATE INDEX "asset_localDateTime_month_idx" ON asset USING btree ((date_trunc('MONTH'::text, ("localDateTime" AT TIME ZONE 'UTC'::text)) AT TIME ZONE 'UTC'::text));
   3040 
   3041 
   3042 --
   3043 -- Name: asset_metadata_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3044 --
   3045 
   3046 CREATE INDEX "asset_metadata_audit_assetId_idx" ON asset_metadata_audit USING btree ("assetId");
   3047 
   3048 
   3049 --
   3050 -- Name: asset_metadata_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3051 --
   3052 
   3053 CREATE INDEX "asset_metadata_audit_deletedAt_idx" ON asset_metadata_audit USING btree ("deletedAt");
   3054 
   3055 
   3056 --
   3057 -- Name: asset_metadata_audit_key_idx; Type: INDEX; Schema: public; Owner: postgres
   3058 --
   3059 
   3060 CREATE INDEX asset_metadata_audit_key_idx ON asset_metadata_audit USING btree (key);
   3061 
   3062 
   3063 --
   3064 -- Name: asset_metadata_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3065 --
   3066 
   3067 CREATE INDEX "asset_metadata_updateId_idx" ON asset_metadata USING btree ("updateId");
   3068 
   3069 
   3070 --
   3071 -- Name: asset_metadata_updatedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3072 --
   3073 
   3074 CREATE INDEX "asset_metadata_updatedAt_idx" ON asset_metadata USING btree ("updatedAt");
   3075 
   3076 
   3077 --
   3078 -- Name: asset_ocr_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3079 --
   3080 
   3081 CREATE INDEX "asset_ocr_assetId_idx" ON asset_ocr USING btree ("assetId");
   3082 
   3083 
   3084 --
   3085 -- Name: asset_ocr_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3086 --
   3087 
   3088 CREATE INDEX "asset_ocr_audit_assetId_idx" ON asset_ocr_audit USING btree ("assetId");
   3089 
   3090 
   3091 --
   3092 -- Name: asset_ocr_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3093 --
   3094 
   3095 CREATE INDEX "asset_ocr_audit_deletedAt_idx" ON asset_ocr_audit USING btree ("deletedAt");
   3096 
   3097 
   3098 --
   3099 -- Name: asset_ocr_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3100 --
   3101 
   3102 CREATE INDEX "asset_ocr_updateId_idx" ON asset_ocr USING btree ("updateId");
   3103 
   3104 
   3105 --
   3106 -- Name: asset_originalFileName_idx; Type: INDEX; Schema: public; Owner: postgres
   3107 --
   3108 
   3109 CREATE INDEX "asset_originalFileName_idx" ON asset USING btree ("originalFileName");
   3110 
   3111 
   3112 --
   3113 -- Name: asset_originalFilename_trigram_idx; Type: INDEX; Schema: public; Owner: postgres
   3114 --
   3115 
   3116 CREATE INDEX "asset_originalFilename_trigram_idx" ON asset USING gin (public.f_unaccent(("originalFileName")::text) gin_trgm_ops);
   3117 
   3118 
   3119 --
   3120 -- Name: asset_originalPath_libraryId_idx; Type: INDEX; Schema: public; Owner: postgres
   3121 --
   3122 
   3123 CREATE INDEX "asset_originalPath_libraryId_idx" ON asset USING btree ("originalPath", "libraryId");
   3124 
   3125 
   3126 --
   3127 -- Name: asset_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3128 --
   3129 
   3130 CREATE INDEX "asset_ownerId_idx" ON asset USING btree ("ownerId");
   3131 
   3132 
   3133 --
   3134 -- Name: asset_ownerId_libraryId_checksum_idx; Type: INDEX; Schema: public; Owner: postgres
   3135 --
   3136 
   3137 CREATE UNIQUE INDEX "asset_ownerId_libraryId_checksum_idx" ON asset USING btree ("ownerId", "libraryId", checksum) WHERE ("libraryId" IS NOT NULL);
   3138 
   3139 
   3140 --
   3141 -- Name: asset_stackId_idx; Type: INDEX; Schema: public; Owner: postgres
   3142 --
   3143 
   3144 CREATE INDEX "asset_stackId_idx" ON asset USING btree ("stackId");
   3145 
   3146 
   3147 --
   3148 -- Name: asset_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3149 --
   3150 
   3151 CREATE INDEX "asset_updateId_idx" ON asset USING btree ("updateId");
   3152 
   3153 
   3154 --
   3155 -- Name: clip_index; Type: INDEX; Schema: public; Owner: postgres
   3156 --
   3157 
   3158 CREATE INDEX clip_index ON smart_search USING vchordrq (embedding vector_cosine_ops) WITH (options='
   3159         residual_quantization = false
   3160         [build.internal]
   3161         lists = [1]
   3162         spherical_centroids = true
   3163         build_threads = 4
   3164         sampling_factor = 1024
   3165         ');
   3166 
   3167 
   3168 --
   3169 -- Name: cluster_group_request_clusterGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3170 --
   3171 
   3172 CREATE INDEX "cluster_group_request_clusterGroupId_idx" ON cluster_group_request USING btree ("clusterGroupId");
   3173 
   3174 
   3175 --
   3176 -- Name: cluster_group_request_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   3177 --
   3178 
   3179 CREATE INDEX "cluster_group_request_userId_idx" ON cluster_group_request USING btree ("userId");
   3180 
   3181 
   3182 --
   3183 -- Name: cluster_group_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3184 --
   3185 
   3186 CREATE INDEX "cluster_group_updateId_idx" ON cluster_group USING btree ("updateId");
   3187 
   3188 
   3189 --
   3190 -- Name: face_index; Type: INDEX; Schema: public; Owner: postgres
   3191 --
   3192 
   3193 CREATE INDEX face_index ON face_search USING vchordrq (embedding vector_cosine_ops) WITH (options='
   3194         residual_quantization = false
   3195         [build.internal]
   3196         lists = [1]
   3197         spherical_centroids = true
   3198         build_threads = 4
   3199         sampling_factor = 1024
   3200         ');
   3201 
   3202 
   3203 --
   3204 -- Name: idx_geodata_places_admin1_name; Type: INDEX; Schema: public; Owner: postgres
   3205 --
   3206 
   3207 CREATE INDEX idx_geodata_places_admin1_name ON geodata_places USING gin (public.f_unaccent(("admin1Name")::text) gin_trgm_ops);
   3208 
   3209 
   3210 --
   3211 -- Name: idx_geodata_places_admin2_name; Type: INDEX; Schema: public; Owner: postgres
   3212 --
   3213 
   3214 CREATE INDEX idx_geodata_places_admin2_name ON geodata_places USING gin (public.f_unaccent(("admin2Name")::text) gin_trgm_ops);
   3215 
   3216 
   3217 --
   3218 -- Name: idx_geodata_places_alternate_names; Type: INDEX; Schema: public; Owner: postgres
   3219 --
   3220 
   3221 CREATE INDEX idx_geodata_places_alternate_names ON geodata_places USING gin (public.f_unaccent(("alternateNames")::text) gin_trgm_ops);
   3222 
   3223 
   3224 --
   3225 -- Name: idx_geodata_places_name; Type: INDEX; Schema: public; Owner: postgres
   3226 --
   3227 
   3228 CREATE INDEX idx_geodata_places_name ON geodata_places USING gin (public.f_unaccent((name)::text) gin_trgm_ops);
   3229 
   3230 
   3231 --
   3232 -- Name: idx_ocr_search_text; Type: INDEX; Schema: public; Owner: postgres
   3233 --
   3234 
   3235 CREATE INDEX idx_ocr_search_text ON ocr_search USING gin (public.f_unaccent(text) gin_trgm_ops);
   3236 
   3237 
   3238 --
   3239 -- Name: idx_person_name_trigram; Type: INDEX; Schema: public; Owner: postgres
   3240 --
   3241 
   3242 CREATE INDEX idx_person_name_trigram ON person USING gin (public.f_unaccent((name)::text) gin_trgm_ops);
   3243 
   3244 
   3245 --
   3246 -- Name: integrity_report_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3247 --
   3248 
   3249 CREATE INDEX "integrity_report_assetId_idx" ON integrity_report USING btree ("assetId");
   3250 
   3251 
   3252 --
   3253 -- Name: integrity_report_fileAssetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3254 --
   3255 
   3256 CREATE INDEX "integrity_report_fileAssetId_idx" ON integrity_report USING btree ("fileAssetId");
   3257 
   3258 
   3259 --
   3260 -- Name: library_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3261 --
   3262 
   3263 CREATE INDEX "library_ownerId_idx" ON library USING btree ("ownerId");
   3264 
   3265 
   3266 --
   3267 -- Name: library_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3268 --
   3269 
   3270 CREATE INDEX "library_updateId_idx" ON library USING btree ("updateId");
   3271 
   3272 
   3273 --
   3274 -- Name: memory_asset_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3275 --
   3276 
   3277 CREATE INDEX "memory_asset_assetId_idx" ON memory_asset USING btree ("assetId");
   3278 
   3279 
   3280 --
   3281 -- Name: memory_asset_audit_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3282 --
   3283 
   3284 CREATE INDEX "memory_asset_audit_assetId_idx" ON memory_asset_audit USING btree ("assetId");
   3285 
   3286 
   3287 --
   3288 -- Name: memory_asset_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3289 --
   3290 
   3291 CREATE INDEX "memory_asset_audit_deletedAt_idx" ON memory_asset_audit USING btree ("deletedAt");
   3292 
   3293 
   3294 --
   3295 -- Name: memory_asset_audit_memoryId_idx; Type: INDEX; Schema: public; Owner: postgres
   3296 --
   3297 
   3298 CREATE INDEX "memory_asset_audit_memoryId_idx" ON memory_asset_audit USING btree ("memoryId");
   3299 
   3300 
   3301 --
   3302 -- Name: memory_asset_memoriesId_idx; Type: INDEX; Schema: public; Owner: postgres
   3303 --
   3304 
   3305 CREATE INDEX "memory_asset_memoriesId_idx" ON memory_asset USING btree ("memoriesId");
   3306 
   3307 
   3308 --
   3309 -- Name: memory_asset_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3310 --
   3311 
   3312 CREATE INDEX "memory_asset_updateId_idx" ON memory_asset USING btree ("updateId");
   3313 
   3314 
   3315 --
   3316 -- Name: memory_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3317 --
   3318 
   3319 CREATE INDEX "memory_audit_deletedAt_idx" ON memory_audit USING btree ("deletedAt");
   3320 
   3321 
   3322 --
   3323 -- Name: memory_audit_memoryId_idx; Type: INDEX; Schema: public; Owner: postgres
   3324 --
   3325 
   3326 CREATE INDEX "memory_audit_memoryId_idx" ON memory_audit USING btree ("memoryId");
   3327 
   3328 
   3329 --
   3330 -- Name: memory_audit_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   3331 --
   3332 
   3333 CREATE INDEX "memory_audit_userId_idx" ON memory_audit USING btree ("userId");
   3334 
   3335 
   3336 --
   3337 -- Name: memory_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3338 --
   3339 
   3340 CREATE INDEX "memory_ownerId_idx" ON memory USING btree ("ownerId");
   3341 
   3342 
   3343 --
   3344 -- Name: memory_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3345 --
   3346 
   3347 CREATE INDEX "memory_updateId_idx" ON memory USING btree ("updateId");
   3348 
   3349 
   3350 --
   3351 -- Name: notification_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3352 --
   3353 
   3354 CREATE INDEX "notification_updateId_idx" ON notification USING btree ("updateId");
   3355 
   3356 
   3357 --
   3358 -- Name: notification_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   3359 --
   3360 
   3361 CREATE INDEX "notification_userId_idx" ON notification USING btree ("userId");
   3362 
   3363 
   3364 --
   3365 -- Name: partner_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3366 --
   3367 
   3368 CREATE INDEX "partner_audit_deletedAt_idx" ON partner_audit USING btree ("deletedAt");
   3369 
   3370 
   3371 --
   3372 -- Name: partner_audit_sharedById_idx; Type: INDEX; Schema: public; Owner: postgres
   3373 --
   3374 
   3375 CREATE INDEX "partner_audit_sharedById_idx" ON partner_audit USING btree ("sharedById");
   3376 
   3377 
   3378 --
   3379 -- Name: partner_audit_sharedWithId_idx; Type: INDEX; Schema: public; Owner: postgres
   3380 --
   3381 
   3382 CREATE INDEX "partner_audit_sharedWithId_idx" ON partner_audit USING btree ("sharedWithId");
   3383 
   3384 
   3385 --
   3386 -- Name: partner_createId_idx; Type: INDEX; Schema: public; Owner: postgres
   3387 --
   3388 
   3389 CREATE INDEX "partner_createId_idx" ON partner USING btree ("createId");
   3390 
   3391 
   3392 --
   3393 -- Name: partner_sharedWithId_idx; Type: INDEX; Schema: public; Owner: postgres
   3394 --
   3395 
   3396 CREATE INDEX "partner_sharedWithId_idx" ON partner USING btree ("sharedWithId");
   3397 
   3398 
   3399 --
   3400 -- Name: partner_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3401 --
   3402 
   3403 CREATE INDEX "partner_updateId_idx" ON partner USING btree ("updateId");
   3404 
   3405 
   3406 --
   3407 -- Name: person_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3408 --
   3409 
   3410 CREATE INDEX "person_audit_deletedAt_idx" ON person_audit USING btree ("deletedAt");
   3411 
   3412 
   3413 --
   3414 -- Name: person_audit_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3415 --
   3416 
   3417 CREATE INDEX "person_audit_ownerId_idx" ON person_audit USING btree ("ownerId");
   3418 
   3419 
   3420 --
   3421 -- Name: person_audit_personGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3422 --
   3423 
   3424 CREATE INDEX "person_audit_personGroupId_idx" ON person_audit USING btree ("personGroupId");
   3425 
   3426 
   3427 --
   3428 -- Name: person_faceAssetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3429 --
   3430 
   3431 CREATE INDEX "person_faceAssetId_idx" ON person USING btree ("faceAssetId");
   3432 
   3433 
   3434 --
   3435 -- Name: person_group_audit_clusterGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3436 --
   3437 
   3438 CREATE INDEX "person_group_audit_clusterGroupId_idx" ON person_group_audit USING btree ("clusterGroupId");
   3439 
   3440 
   3441 --
   3442 -- Name: person_group_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3443 --
   3444 
   3445 CREATE INDEX "person_group_audit_deletedAt_idx" ON person_group_audit USING btree ("deletedAt");
   3446 
   3447 
   3448 --
   3449 -- Name: person_group_audit_personGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3450 --
   3451 
   3452 CREATE INDEX "person_group_audit_personGroupId_idx" ON person_group_audit USING btree ("personGroupId");
   3453 
   3454 
   3455 --
   3456 -- Name: person_group_clusterGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3457 --
   3458 
   3459 CREATE INDEX "person_group_clusterGroupId_idx" ON person_group USING btree ("clusterGroupId");
   3460 
   3461 
   3462 --
   3463 -- Name: person_group_createId_idx; Type: INDEX; Schema: public; Owner: postgres
   3464 --
   3465 
   3466 CREATE INDEX "person_group_createId_idx" ON person_group USING btree ("createId");
   3467 
   3468 
   3469 --
   3470 -- Name: person_group_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3471 --
   3472 
   3473 CREATE INDEX "person_group_updateId_idx" ON person_group USING btree ("updateId");
   3474 
   3475 
   3476 --
   3477 -- Name: person_personGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3478 --
   3479 
   3480 CREATE INDEX "person_personGroupId_idx" ON person USING btree ("personGroupId");
   3481 
   3482 
   3483 --
   3484 -- Name: person_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3485 --
   3486 
   3487 CREATE INDEX "person_updateId_idx" ON person USING btree ("updateId");
   3488 
   3489 
   3490 --
   3491 -- Name: plugin_method_pluginId_idx; Type: INDEX; Schema: public; Owner: postgres
   3492 --
   3493 
   3494 CREATE INDEX "plugin_method_pluginId_idx" ON plugin_method USING btree ("pluginId");
   3495 
   3496 
   3497 --
   3498 -- Name: plugin_name_idx; Type: INDEX; Schema: public; Owner: postgres
   3499 --
   3500 
   3501 CREATE INDEX plugin_name_idx ON plugin USING btree (name);
   3502 
   3503 
   3504 --
   3505 -- Name: session_oauthSid_idx; Type: INDEX; Schema: public; Owner: postgres
   3506 --
   3507 
   3508 CREATE INDEX "session_oauthSid_idx" ON session USING btree ("oauthSid");
   3509 
   3510 
   3511 --
   3512 -- Name: session_parentId_idx; Type: INDEX; Schema: public; Owner: postgres
   3513 --
   3514 
   3515 CREATE INDEX "session_parentId_idx" ON session USING btree ("parentId");
   3516 
   3517 
   3518 --
   3519 -- Name: session_sync_checkpoint_sessionId_idx; Type: INDEX; Schema: public; Owner: postgres
   3520 --
   3521 
   3522 CREATE INDEX "session_sync_checkpoint_sessionId_idx" ON session_sync_checkpoint USING btree ("sessionId");
   3523 
   3524 
   3525 --
   3526 -- Name: session_sync_checkpoint_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3527 --
   3528 
   3529 CREATE INDEX "session_sync_checkpoint_updateId_idx" ON session_sync_checkpoint USING btree ("updateId");
   3530 
   3531 
   3532 --
   3533 -- Name: session_token_idx; Type: INDEX; Schema: public; Owner: postgres
   3534 --
   3535 
   3536 CREATE INDEX session_token_idx ON session USING btree (token);
   3537 
   3538 
   3539 --
   3540 -- Name: session_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3541 --
   3542 
   3543 CREATE INDEX "session_updateId_idx" ON session USING btree ("updateId");
   3544 
   3545 
   3546 --
   3547 -- Name: session_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   3548 --
   3549 
   3550 CREATE INDEX "session_userId_idx" ON session USING btree ("userId");
   3551 
   3552 
   3553 --
   3554 -- Name: shared_link_albumId_idx; Type: INDEX; Schema: public; Owner: postgres
   3555 --
   3556 
   3557 CREATE INDEX "shared_link_albumId_idx" ON shared_link USING btree ("albumId");
   3558 
   3559 
   3560 --
   3561 -- Name: shared_link_asset_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3562 --
   3563 
   3564 CREATE INDEX "shared_link_asset_assetId_idx" ON shared_link_asset USING btree ("assetId");
   3565 
   3566 
   3567 --
   3568 -- Name: shared_link_asset_sharedLinkId_idx; Type: INDEX; Schema: public; Owner: postgres
   3569 --
   3570 
   3571 CREATE INDEX "shared_link_asset_sharedLinkId_idx" ON shared_link_asset USING btree ("sharedLinkId");
   3572 
   3573 
   3574 --
   3575 -- Name: shared_link_key_idx; Type: INDEX; Schema: public; Owner: postgres
   3576 --
   3577 
   3578 CREATE INDEX shared_link_key_idx ON shared_link USING btree (key);
   3579 
   3580 
   3581 --
   3582 -- Name: shared_link_userId_idx; Type: INDEX; Schema: public; Owner: postgres
   3583 --
   3584 
   3585 CREATE INDEX "shared_link_userId_idx" ON shared_link USING btree ("userId");
   3586 
   3587 
   3588 --
   3589 -- Name: stack_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3590 --
   3591 
   3592 CREATE INDEX "stack_audit_deletedAt_idx" ON stack_audit USING btree ("deletedAt");
   3593 
   3594 
   3595 --
   3596 -- Name: stack_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3597 --
   3598 
   3599 CREATE INDEX "stack_ownerId_idx" ON stack USING btree ("ownerId");
   3600 
   3601 
   3602 --
   3603 -- Name: stack_primaryAssetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3604 --
   3605 
   3606 CREATE INDEX "stack_primaryAssetId_idx" ON stack USING btree ("primaryAssetId");
   3607 
   3608 
   3609 --
   3610 -- Name: tag_asset_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3611 --
   3612 
   3613 CREATE INDEX "tag_asset_assetId_idx" ON tag_asset USING btree ("assetId");
   3614 
   3615 
   3616 --
   3617 -- Name: tag_asset_assetId_tagId_idx; Type: INDEX; Schema: public; Owner: postgres
   3618 --
   3619 
   3620 CREATE INDEX "tag_asset_assetId_tagId_idx" ON tag_asset USING btree ("assetId", "tagId");
   3621 
   3622 
   3623 --
   3624 -- Name: tag_asset_tagId_idx; Type: INDEX; Schema: public; Owner: postgres
   3625 --
   3626 
   3627 CREATE INDEX "tag_asset_tagId_idx" ON tag_asset USING btree ("tagId");
   3628 
   3629 
   3630 --
   3631 -- Name: tag_closure_id_ancestor_idx; Type: INDEX; Schema: public; Owner: postgres
   3632 --
   3633 
   3634 CREATE INDEX tag_closure_id_ancestor_idx ON tag_closure USING btree (id_ancestor);
   3635 
   3636 
   3637 --
   3638 -- Name: tag_closure_id_descendant_idx; Type: INDEX; Schema: public; Owner: postgres
   3639 --
   3640 
   3641 CREATE INDEX tag_closure_id_descendant_idx ON tag_closure USING btree (id_descendant);
   3642 
   3643 
   3644 --
   3645 -- Name: tag_parentId_idx; Type: INDEX; Schema: public; Owner: postgres
   3646 --
   3647 
   3648 CREATE INDEX "tag_parentId_idx" ON tag USING btree ("parentId");
   3649 
   3650 
   3651 --
   3652 -- Name: tag_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3653 --
   3654 
   3655 CREATE INDEX "tag_updateId_idx" ON tag USING btree ("updateId");
   3656 
   3657 
   3658 --
   3659 -- Name: user_audit_deletedAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3660 --
   3661 
   3662 CREATE INDEX "user_audit_deletedAt_idx" ON user_audit USING btree ("deletedAt");
   3663 
   3664 
   3665 --
   3666 -- Name: user_clusterGroupId_idx; Type: INDEX; Schema: public; Owner: postgres
   3667 --
   3668 
   3669 CREATE INDEX "user_clusterGroupId_idx" ON "user" USING btree ("clusterGroupId");
   3670 
   3671 
   3672 --
   3673 -- Name: user_updateId_idx; Type: INDEX; Schema: public; Owner: postgres
   3674 --
   3675 
   3676 CREATE INDEX "user_updateId_idx" ON "user" USING btree ("updateId");
   3677 
   3678 
   3679 --
   3680 -- Name: user_updatedAt_id_idx; Type: INDEX; Schema: public; Owner: postgres
   3681 --
   3682 
   3683 CREATE INDEX "user_updatedAt_id_idx" ON "user" USING btree ("updatedAt", id);
   3684 
   3685 
   3686 --
   3687 -- Name: video_stream_session_assetId_idx; Type: INDEX; Schema: public; Owner: postgres
   3688 --
   3689 
   3690 CREATE INDEX "video_stream_session_assetId_idx" ON video_stream_session USING btree ("assetId");
   3691 
   3692 
   3693 --
   3694 -- Name: video_stream_session_expiresAt_idx; Type: INDEX; Schema: public; Owner: postgres
   3695 --
   3696 
   3697 CREATE INDEX "video_stream_session_expiresAt_idx" ON video_stream_session USING btree ("expiresAt");
   3698 
   3699 
   3700 --
   3701 -- Name: video_stream_variant_sessionId_bitrate_resolution_codec_idx; Type: INDEX; Schema: public; Owner: postgres
   3702 --
   3703 
   3704 CREATE UNIQUE INDEX "video_stream_variant_sessionId_bitrate_resolution_codec_idx" ON video_stream_variant USING btree ("sessionId", bitrate, resolution, codec);
   3705 
   3706 
   3707 --
   3708 -- Name: workflow_log_workflowId_idx; Type: INDEX; Schema: public; Owner: postgres
   3709 --
   3710 
   3711 CREATE INDEX "workflow_log_workflowId_idx" ON workflow_log USING btree ("workflowId");
   3712 
   3713 
   3714 --
   3715 -- Name: workflow_log_workflowStepId_idx; Type: INDEX; Schema: public; Owner: postgres
   3716 --
   3717 
   3718 CREATE INDEX "workflow_log_workflowStepId_idx" ON workflow_log USING btree ("workflowStepId");
   3719 
   3720 
   3721 --
   3722 -- Name: workflow_ownerId_idx; Type: INDEX; Schema: public; Owner: postgres
   3723 --
   3724 
   3725 CREATE INDEX "workflow_ownerId_idx" ON workflow USING btree ("ownerId");
   3726 
   3727 
   3728 --
   3729 -- Name: workflow_step_pluginMethodId_idx; Type: INDEX; Schema: public; Owner: postgres
   3730 --
   3731 
   3732 CREATE INDEX "workflow_step_pluginMethodId_idx" ON workflow_step USING btree ("pluginMethodId");
   3733 
   3734 
   3735 --
   3736 -- Name: workflow_step_workflowId_idx; Type: INDEX; Schema: public; Owner: postgres
   3737 --
   3738 
   3739 CREATE INDEX "workflow_step_workflowId_idx" ON workflow_step USING btree ("workflowId");
   3740 
   3741 
   3742 --
   3743 -- Name: activity activity_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3744 --
   3745 
   3746 CREATE TRIGGER "activity_updatedAt" BEFORE UPDATE ON activity FOR EACH ROW EXECUTE FUNCTION updated_at();
   3747 
   3748 
   3749 --
   3750 -- Name: album_asset album_asset_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3751 --
   3752 
   3753 CREATE TRIGGER album_asset_delete_audit AFTER DELETE ON album_asset REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() <= 1)) EXECUTE FUNCTION album_asset_delete_audit();
   3754 
   3755 
   3756 --
   3757 -- Name: album_asset album_asset_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3758 --
   3759 
   3760 CREATE TRIGGER "album_asset_updatedAt" BEFORE UPDATE ON album_asset FOR EACH ROW EXECUTE FUNCTION updated_at();
   3761 
   3762 
   3763 --
   3764 -- Name: album album_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3765 --
   3766 
   3767 CREATE TRIGGER "album_updatedAt" BEFORE UPDATE ON album FOR EACH ROW EXECUTE FUNCTION updated_at();
   3768 
   3769 
   3770 --
   3771 -- Name: album_user album_user_after_insert; Type: TRIGGER; Schema: public; Owner: postgres
   3772 --
   3773 
   3774 CREATE TRIGGER album_user_after_insert AFTER INSERT ON album_user REFERENCING NEW TABLE AS inserted_rows FOR EACH STATEMENT EXECUTE FUNCTION album_user_after_insert();
   3775 
   3776 
   3777 --
   3778 -- Name: album_user album_user_delete; Type: TRIGGER; Schema: public; Owner: postgres
   3779 --
   3780 
   3781 CREATE TRIGGER album_user_delete AFTER DELETE ON album_user REFERENCING OLD TABLE AS old FOR EACH ROW EXECUTE FUNCTION album_user_delete();
   3782 
   3783 
   3784 --
   3785 -- Name: album_user album_user_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3786 --
   3787 
   3788 CREATE TRIGGER album_user_delete_audit AFTER DELETE ON album_user REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() <= 1)) EXECUTE FUNCTION album_user_delete_audit();
   3789 
   3790 
   3791 --
   3792 -- Name: album_user album_user_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3793 --
   3794 
   3795 CREATE TRIGGER "album_user_updatedAt" BEFORE UPDATE ON album_user FOR EACH ROW EXECUTE FUNCTION updated_at();
   3796 
   3797 
   3798 --
   3799 -- Name: api_key api_key_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3800 --
   3801 
   3802 CREATE TRIGGER "api_key_updatedAt" BEFORE UPDATE ON api_key FOR EACH ROW EXECUTE FUNCTION updated_at();
   3803 
   3804 
   3805 --
   3806 -- Name: asset asset_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3807 --
   3808 
   3809 CREATE TRIGGER asset_delete_audit AFTER DELETE ON asset REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_delete_audit();
   3810 
   3811 
   3812 --
   3813 -- Name: asset_edit asset_edit_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3814 --
   3815 
   3816 CREATE TRIGGER asset_edit_audit AFTER DELETE ON asset_edit REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_edit_audit();
   3817 
   3818 
   3819 --
   3820 -- Name: asset_edit asset_edit_delete; Type: TRIGGER; Schema: public; Owner: postgres
   3821 --
   3822 
   3823 CREATE TRIGGER asset_edit_delete AFTER DELETE ON asset_edit REFERENCING OLD TABLE AS deleted_edit FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_edit_delete();
   3824 
   3825 
   3826 --
   3827 -- Name: asset_edit asset_edit_insert; Type: TRIGGER; Schema: public; Owner: postgres
   3828 --
   3829 
   3830 CREATE TRIGGER asset_edit_insert AFTER INSERT ON asset_edit REFERENCING NEW TABLE AS inserted_edit FOR EACH STATEMENT EXECUTE FUNCTION asset_edit_insert();
   3831 
   3832 
   3833 --
   3834 -- Name: asset_edit asset_edit_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3835 --
   3836 
   3837 CREATE TRIGGER "asset_edit_updatedAt" BEFORE UPDATE ON asset_edit FOR EACH ROW EXECUTE FUNCTION updated_at();
   3838 
   3839 
   3840 --
   3841 -- Name: asset_exif asset_exif_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3842 --
   3843 
   3844 CREATE TRIGGER "asset_exif_updatedAt" BEFORE UPDATE ON asset_exif FOR EACH ROW EXECUTE FUNCTION updated_at();
   3845 
   3846 
   3847 --
   3848 -- Name: asset_face asset_face_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3849 --
   3850 
   3851 CREATE TRIGGER asset_face_audit AFTER DELETE ON asset_face REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_face_audit();
   3852 
   3853 
   3854 --
   3855 -- Name: asset_face asset_face_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3856 --
   3857 
   3858 CREATE TRIGGER "asset_face_updatedAt" BEFORE UPDATE ON asset_face FOR EACH ROW EXECUTE FUNCTION updated_at();
   3859 
   3860 
   3861 --
   3862 -- Name: asset_file asset_file_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3863 --
   3864 
   3865 CREATE TRIGGER "asset_file_updatedAt" BEFORE UPDATE ON asset_file FOR EACH ROW EXECUTE FUNCTION updated_at();
   3866 
   3867 
   3868 --
   3869 -- Name: asset_metadata asset_metadata_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3870 --
   3871 
   3872 CREATE TRIGGER asset_metadata_audit AFTER DELETE ON asset_metadata REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_metadata_audit();
   3873 
   3874 
   3875 --
   3876 -- Name: asset_metadata asset_metadata_updated_at; Type: TRIGGER; Schema: public; Owner: postgres
   3877 --
   3878 
   3879 CREATE TRIGGER asset_metadata_updated_at BEFORE UPDATE ON asset_metadata FOR EACH ROW EXECUTE FUNCTION updated_at();
   3880 
   3881 
   3882 --
   3883 -- Name: asset_ocr asset_ocr_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3884 --
   3885 
   3886 CREATE TRIGGER asset_ocr_delete_audit AFTER DELETE ON asset_ocr REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION asset_ocr_delete_audit();
   3887 
   3888 
   3889 --
   3890 -- Name: asset_ocr asset_ocr_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3891 --
   3892 
   3893 CREATE TRIGGER "asset_ocr_updatedAt" BEFORE UPDATE ON asset_ocr FOR EACH ROW EXECUTE FUNCTION updated_at();
   3894 
   3895 
   3896 --
   3897 -- Name: asset asset_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3898 --
   3899 
   3900 CREATE TRIGGER "asset_updatedAt" BEFORE UPDATE ON asset FOR EACH ROW EXECUTE FUNCTION updated_at();
   3901 
   3902 
   3903 --
   3904 -- Name: cluster_group cluster_group_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3905 --
   3906 
   3907 CREATE TRIGGER "cluster_group_updatedAt" BEFORE UPDATE ON cluster_group FOR EACH ROW EXECUTE FUNCTION updated_at();
   3908 
   3909 
   3910 --
   3911 -- Name: library library_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3912 --
   3913 
   3914 CREATE TRIGGER "library_updatedAt" BEFORE UPDATE ON library FOR EACH ROW EXECUTE FUNCTION updated_at();
   3915 
   3916 
   3917 --
   3918 -- Name: memory_asset memory_asset_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3919 --
   3920 
   3921 CREATE TRIGGER memory_asset_delete_audit AFTER DELETE ON memory_asset REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() <= 1)) EXECUTE FUNCTION memory_asset_delete_audit();
   3922 
   3923 
   3924 --
   3925 -- Name: memory_asset memory_asset_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3926 --
   3927 
   3928 CREATE TRIGGER "memory_asset_updatedAt" BEFORE UPDATE ON memory_asset FOR EACH ROW EXECUTE FUNCTION updated_at();
   3929 
   3930 
   3931 --
   3932 -- Name: memory memory_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3933 --
   3934 
   3935 CREATE TRIGGER memory_delete_audit AFTER DELETE ON memory REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION memory_delete_audit();
   3936 
   3937 
   3938 --
   3939 -- Name: memory memory_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3940 --
   3941 
   3942 CREATE TRIGGER "memory_updatedAt" BEFORE UPDATE ON memory FOR EACH ROW EXECUTE FUNCTION updated_at();
   3943 
   3944 
   3945 --
   3946 -- Name: notification notification_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3947 --
   3948 
   3949 CREATE TRIGGER "notification_updatedAt" BEFORE UPDATE ON notification FOR EACH ROW EXECUTE FUNCTION updated_at();
   3950 
   3951 
   3952 --
   3953 -- Name: partner partner_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3954 --
   3955 
   3956 CREATE TRIGGER partner_delete_audit AFTER DELETE ON partner REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION partner_delete_audit();
   3957 
   3958 
   3959 --
   3960 -- Name: partner partner_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3961 --
   3962 
   3963 CREATE TRIGGER "partner_updatedAt" BEFORE UPDATE ON partner FOR EACH ROW EXECUTE FUNCTION updated_at();
   3964 
   3965 
   3966 --
   3967 -- Name: person person_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3968 --
   3969 
   3970 CREATE TRIGGER person_delete_audit AFTER DELETE ON person REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() <= 1)) EXECUTE FUNCTION person_delete_audit();
   3971 
   3972 
   3973 --
   3974 -- Name: person_group person_group_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   3975 --
   3976 
   3977 CREATE TRIGGER person_group_delete_audit AFTER DELETE ON person_group REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION person_group_delete_audit();
   3978 
   3979 
   3980 --
   3981 -- Name: person_group person_group_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3982 --
   3983 
   3984 CREATE TRIGGER "person_group_updatedAt" BEFORE UPDATE ON person_group FOR EACH ROW EXECUTE FUNCTION updated_at();
   3985 
   3986 
   3987 --
   3988 -- Name: person person_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3989 --
   3990 
   3991 CREATE TRIGGER "person_updatedAt" BEFORE UPDATE ON person FOR EACH ROW EXECUTE FUNCTION updated_at();
   3992 
   3993 
   3994 --
   3995 -- Name: session_sync_checkpoint session_sync_checkpoint_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   3996 --
   3997 
   3998 CREATE TRIGGER "session_sync_checkpoint_updatedAt" BEFORE UPDATE ON session_sync_checkpoint FOR EACH ROW EXECUTE FUNCTION updated_at();
   3999 
   4000 
   4001 --
   4002 -- Name: session session_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   4003 --
   4004 
   4005 CREATE TRIGGER "session_updatedAt" BEFORE UPDATE ON session FOR EACH ROW EXECUTE FUNCTION updated_at();
   4006 
   4007 
   4008 --
   4009 -- Name: stack stack_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   4010 --
   4011 
   4012 CREATE TRIGGER stack_delete_audit AFTER DELETE ON stack REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION stack_delete_audit();
   4013 
   4014 
   4015 --
   4016 -- Name: stack stack_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   4017 --
   4018 
   4019 CREATE TRIGGER "stack_updatedAt" BEFORE UPDATE ON stack FOR EACH ROW EXECUTE FUNCTION updated_at();
   4020 
   4021 
   4022 --
   4023 -- Name: tag tag_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   4024 --
   4025 
   4026 CREATE TRIGGER "tag_updatedAt" BEFORE UPDATE ON tag FOR EACH ROW EXECUTE FUNCTION updated_at();
   4027 
   4028 
   4029 --
   4030 -- Name: user user_delete_audit; Type: TRIGGER; Schema: public; Owner: postgres
   4031 --
   4032 
   4033 CREATE TRIGGER user_delete_audit AFTER DELETE ON "user" REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION user_delete_audit();
   4034 
   4035 
   4036 --
   4037 -- Name: user_metadata user_metadata_audit; Type: TRIGGER; Schema: public; Owner: postgres
   4038 --
   4039 
   4040 CREATE TRIGGER user_metadata_audit AFTER DELETE ON user_metadata REFERENCING OLD TABLE AS old FOR EACH STATEMENT WHEN ((pg_trigger_depth() = 0)) EXECUTE FUNCTION user_metadata_audit();
   4041 
   4042 
   4043 --
   4044 -- Name: user_metadata user_metadata_updated_at; Type: TRIGGER; Schema: public; Owner: postgres
   4045 --
   4046 
   4047 CREATE TRIGGER user_metadata_updated_at BEFORE UPDATE ON user_metadata FOR EACH ROW EXECUTE FUNCTION updated_at();
   4048 
   4049 
   4050 --
   4051 -- Name: user user_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   4052 --
   4053 
   4054 CREATE TRIGGER "user_updatedAt" BEFORE UPDATE ON "user" FOR EACH ROW EXECUTE FUNCTION updated_at();
   4055 
   4056 
   4057 --
   4058 -- Name: workflow workflow_updatedAt; Type: TRIGGER; Schema: public; Owner: postgres
   4059 --
   4060 
   4061 CREATE TRIGGER "workflow_updatedAt" BEFORE UPDATE ON workflow FOR EACH ROW EXECUTE FUNCTION updated_at();
   4062 
   4063 
   4064 --
   4065 -- Name: activity activity_albumId_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4066 --
   4067 
   4068 ALTER TABLE ONLY activity
   4069     ADD CONSTRAINT "activity_albumId_assetId_fkey" FOREIGN KEY ("albumId", "assetId") REFERENCES album_asset("albumId", "assetId") ON DELETE CASCADE;
   4070 
   4071 
   4072 --
   4073 -- Name: activity activity_albumId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4074 --
   4075 
   4076 ALTER TABLE ONLY activity
   4077     ADD CONSTRAINT "activity_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES album(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4078 
   4079 
   4080 --
   4081 -- Name: activity activity_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4082 --
   4083 
   4084 ALTER TABLE ONLY activity
   4085     ADD CONSTRAINT "activity_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4086 
   4087 
   4088 --
   4089 -- Name: activity activity_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4090 --
   4091 
   4092 ALTER TABLE ONLY activity
   4093     ADD CONSTRAINT "activity_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4094 
   4095 
   4096 --
   4097 -- Name: album album_albumThumbnailAssetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4098 --
   4099 
   4100 ALTER TABLE ONLY album
   4101     ADD CONSTRAINT "album_albumThumbnailAssetId_fkey" FOREIGN KEY ("albumThumbnailAssetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE SET NULL;
   4102 
   4103 
   4104 --
   4105 -- Name: album_asset album_asset_albumId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4106 --
   4107 
   4108 ALTER TABLE ONLY album_asset
   4109     ADD CONSTRAINT "album_asset_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES album(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4110 
   4111 
   4112 --
   4113 -- Name: album_asset album_asset_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4114 --
   4115 
   4116 ALTER TABLE ONLY album_asset
   4117     ADD CONSTRAINT "album_asset_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4118 
   4119 
   4120 --
   4121 -- Name: album_asset_audit album_asset_audit_albumId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4122 --
   4123 
   4124 ALTER TABLE ONLY album_asset_audit
   4125     ADD CONSTRAINT "album_asset_audit_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES album(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4126 
   4127 
   4128 --
   4129 -- Name: album_user album_user_albumId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4130 --
   4131 
   4132 ALTER TABLE ONLY album_user
   4133     ADD CONSTRAINT "album_user_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES album(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4134 
   4135 
   4136 --
   4137 -- Name: album_user album_user_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4138 --
   4139 
   4140 ALTER TABLE ONLY album_user
   4141     ADD CONSTRAINT "album_user_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4142 
   4143 
   4144 --
   4145 -- Name: api_key api_key_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4146 --
   4147 
   4148 ALTER TABLE ONLY api_key
   4149     ADD CONSTRAINT "api_key_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4150 
   4151 
   4152 --
   4153 -- Name: asset_audio asset_audio_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4154 --
   4155 
   4156 ALTER TABLE ONLY asset_audio
   4157     ADD CONSTRAINT "asset_audio_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4158 
   4159 
   4160 --
   4161 -- Name: asset_edit asset_edit_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4162 --
   4163 
   4164 ALTER TABLE ONLY asset_edit
   4165     ADD CONSTRAINT "asset_edit_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4166 
   4167 
   4168 --
   4169 -- Name: asset_exif asset_exif_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4170 --
   4171 
   4172 ALTER TABLE ONLY asset_exif
   4173     ADD CONSTRAINT "asset_exif_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4174 
   4175 
   4176 --
   4177 -- Name: asset_face asset_face_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4178 --
   4179 
   4180 ALTER TABLE ONLY asset_face
   4181     ADD CONSTRAINT "asset_face_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4182 
   4183 
   4184 --
   4185 -- Name: asset_face asset_face_personGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4186 --
   4187 
   4188 ALTER TABLE ONLY asset_face
   4189     ADD CONSTRAINT "asset_face_personGroupId_fkey" FOREIGN KEY ("personGroupId") REFERENCES person_group(id) ON UPDATE CASCADE ON DELETE SET NULL;
   4190 
   4191 
   4192 --
   4193 -- Name: asset_file asset_file_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4194 --
   4195 
   4196 ALTER TABLE ONLY asset_file
   4197     ADD CONSTRAINT "asset_file_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4198 
   4199 
   4200 --
   4201 -- Name: asset_job_status asset_job_status_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4202 --
   4203 
   4204 ALTER TABLE ONLY asset_job_status
   4205     ADD CONSTRAINT "asset_job_status_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4206 
   4207 
   4208 --
   4209 -- Name: asset_keyframe asset_keyframe_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4210 --
   4211 
   4212 ALTER TABLE ONLY asset_keyframe
   4213     ADD CONSTRAINT "asset_keyframe_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4214 
   4215 
   4216 --
   4217 -- Name: asset asset_libraryId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4218 --
   4219 
   4220 ALTER TABLE ONLY asset
   4221     ADD CONSTRAINT "asset_libraryId_fkey" FOREIGN KEY ("libraryId") REFERENCES library(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4222 
   4223 
   4224 --
   4225 -- Name: asset asset_livePhotoVideoId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4226 --
   4227 
   4228 ALTER TABLE ONLY asset
   4229     ADD CONSTRAINT "asset_livePhotoVideoId_fkey" FOREIGN KEY ("livePhotoVideoId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE SET NULL;
   4230 
   4231 
   4232 --
   4233 -- Name: asset_metadata asset_metadata_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4234 --
   4235 
   4236 ALTER TABLE ONLY asset_metadata
   4237     ADD CONSTRAINT "asset_metadata_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4238 
   4239 
   4240 --
   4241 -- Name: asset_ocr asset_ocr_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4242 --
   4243 
   4244 ALTER TABLE ONLY asset_ocr
   4245     ADD CONSTRAINT "asset_ocr_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4246 
   4247 
   4248 --
   4249 -- Name: asset asset_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4250 --
   4251 
   4252 ALTER TABLE ONLY asset
   4253     ADD CONSTRAINT "asset_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4254 
   4255 
   4256 --
   4257 -- Name: asset asset_stackId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4258 --
   4259 
   4260 ALTER TABLE ONLY asset
   4261     ADD CONSTRAINT "asset_stackId_fkey" FOREIGN KEY ("stackId") REFERENCES stack(id) ON UPDATE CASCADE ON DELETE SET NULL;
   4262 
   4263 
   4264 --
   4265 -- Name: asset_video asset_video_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4266 --
   4267 
   4268 ALTER TABLE ONLY asset_video
   4269     ADD CONSTRAINT "asset_video_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4270 
   4271 
   4272 --
   4273 -- Name: cluster_group_request cluster_group_request_clusterGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4274 --
   4275 
   4276 ALTER TABLE ONLY cluster_group_request
   4277     ADD CONSTRAINT "cluster_group_request_clusterGroupId_fkey" FOREIGN KEY ("clusterGroupId") REFERENCES cluster_group(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4278 
   4279 
   4280 --
   4281 -- Name: cluster_group_request cluster_group_request_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4282 --
   4283 
   4284 ALTER TABLE ONLY cluster_group_request
   4285     ADD CONSTRAINT "cluster_group_request_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4286 
   4287 
   4288 --
   4289 -- Name: face_search face_search_faceId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4290 --
   4291 
   4292 ALTER TABLE ONLY face_search
   4293     ADD CONSTRAINT "face_search_faceId_fkey" FOREIGN KEY ("faceId") REFERENCES asset_face(id) ON DELETE CASCADE;
   4294 
   4295 
   4296 --
   4297 -- Name: integrity_report integrity_report_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4298 --
   4299 
   4300 ALTER TABLE ONLY integrity_report
   4301     ADD CONSTRAINT "integrity_report_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4302 
   4303 
   4304 --
   4305 -- Name: integrity_report integrity_report_fileAssetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4306 --
   4307 
   4308 ALTER TABLE ONLY integrity_report
   4309     ADD CONSTRAINT "integrity_report_fileAssetId_fkey" FOREIGN KEY ("fileAssetId") REFERENCES asset_file(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4310 
   4311 
   4312 --
   4313 -- Name: library library_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4314 --
   4315 
   4316 ALTER TABLE ONLY library
   4317     ADD CONSTRAINT "library_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4318 
   4319 
   4320 --
   4321 -- Name: memory_asset memory_asset_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4322 --
   4323 
   4324 ALTER TABLE ONLY memory_asset
   4325     ADD CONSTRAINT "memory_asset_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4326 
   4327 
   4328 --
   4329 -- Name: memory_asset_audit memory_asset_audit_memoryId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4330 --
   4331 
   4332 ALTER TABLE ONLY memory_asset_audit
   4333     ADD CONSTRAINT "memory_asset_audit_memoryId_fkey" FOREIGN KEY ("memoryId") REFERENCES memory(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4334 
   4335 
   4336 --
   4337 -- Name: memory_asset memory_asset_memoriesId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4338 --
   4339 
   4340 ALTER TABLE ONLY memory_asset
   4341     ADD CONSTRAINT "memory_asset_memoriesId_fkey" FOREIGN KEY ("memoriesId") REFERENCES memory(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4342 
   4343 
   4344 --
   4345 -- Name: memory memory_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4346 --
   4347 
   4348 ALTER TABLE ONLY memory
   4349     ADD CONSTRAINT "memory_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4350 
   4351 
   4352 --
   4353 -- Name: notification notification_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4354 --
   4355 
   4356 ALTER TABLE ONLY notification
   4357     ADD CONSTRAINT "notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4358 
   4359 
   4360 --
   4361 -- Name: ocr_search ocr_search_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4362 --
   4363 
   4364 ALTER TABLE ONLY ocr_search
   4365     ADD CONSTRAINT "ocr_search_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4366 
   4367 
   4368 --
   4369 -- Name: partner partner_sharedById_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4370 --
   4371 
   4372 ALTER TABLE ONLY partner
   4373     ADD CONSTRAINT "partner_sharedById_fkey" FOREIGN KEY ("sharedById") REFERENCES "user"(id) ON DELETE CASCADE;
   4374 
   4375 
   4376 --
   4377 -- Name: partner partner_sharedWithId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4378 --
   4379 
   4380 ALTER TABLE ONLY partner
   4381     ADD CONSTRAINT "partner_sharedWithId_fkey" FOREIGN KEY ("sharedWithId") REFERENCES "user"(id) ON DELETE CASCADE;
   4382 
   4383 
   4384 --
   4385 -- Name: person person_faceAssetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4386 --
   4387 
   4388 ALTER TABLE ONLY person
   4389     ADD CONSTRAINT "person_faceAssetId_fkey" FOREIGN KEY ("faceAssetId") REFERENCES asset_face(id) ON DELETE SET NULL;
   4390 
   4391 
   4392 --
   4393 -- Name: person_group person_group_clusterGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4394 --
   4395 
   4396 ALTER TABLE ONLY person_group
   4397     ADD CONSTRAINT "person_group_clusterGroupId_fkey" FOREIGN KEY ("clusterGroupId") REFERENCES cluster_group(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4398 
   4399 
   4400 --
   4401 -- Name: person person_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4402 --
   4403 
   4404 ALTER TABLE ONLY person
   4405     ADD CONSTRAINT "person_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4406 
   4407 
   4408 --
   4409 -- Name: person person_personGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4410 --
   4411 
   4412 ALTER TABLE ONLY person
   4413     ADD CONSTRAINT "person_personGroupId_fkey" FOREIGN KEY ("personGroupId") REFERENCES person_group(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4414 
   4415 
   4416 --
   4417 -- Name: plugin_method plugin_method_pluginId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4418 --
   4419 
   4420 ALTER TABLE ONLY plugin_method
   4421     ADD CONSTRAINT "plugin_method_pluginId_fkey" FOREIGN KEY ("pluginId") REFERENCES plugin(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4422 
   4423 
   4424 --
   4425 -- Name: session session_parentId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4426 --
   4427 
   4428 ALTER TABLE ONLY session
   4429     ADD CONSTRAINT "session_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES session(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4430 
   4431 
   4432 --
   4433 -- Name: session_sync_checkpoint session_sync_checkpoint_sessionId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4434 --
   4435 
   4436 ALTER TABLE ONLY session_sync_checkpoint
   4437     ADD CONSTRAINT "session_sync_checkpoint_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES session(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4438 
   4439 
   4440 --
   4441 -- Name: session session_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4442 --
   4443 
   4444 ALTER TABLE ONLY session
   4445     ADD CONSTRAINT "session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4446 
   4447 
   4448 --
   4449 -- Name: shared_link shared_link_albumId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4450 --
   4451 
   4452 ALTER TABLE ONLY shared_link
   4453     ADD CONSTRAINT "shared_link_albumId_fkey" FOREIGN KEY ("albumId") REFERENCES album(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4454 
   4455 
   4456 --
   4457 -- Name: shared_link_asset shared_link_asset_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4458 --
   4459 
   4460 ALTER TABLE ONLY shared_link_asset
   4461     ADD CONSTRAINT "shared_link_asset_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4462 
   4463 
   4464 --
   4465 -- Name: shared_link_asset shared_link_asset_sharedLinkId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4466 --
   4467 
   4468 ALTER TABLE ONLY shared_link_asset
   4469     ADD CONSTRAINT "shared_link_asset_sharedLinkId_fkey" FOREIGN KEY ("sharedLinkId") REFERENCES shared_link(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4470 
   4471 
   4472 --
   4473 -- Name: shared_link shared_link_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4474 --
   4475 
   4476 ALTER TABLE ONLY shared_link
   4477     ADD CONSTRAINT "shared_link_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4478 
   4479 
   4480 --
   4481 -- Name: smart_search smart_search_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4482 --
   4483 
   4484 ALTER TABLE ONLY smart_search
   4485     ADD CONSTRAINT "smart_search_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4486 
   4487 
   4488 --
   4489 -- Name: stack stack_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4490 --
   4491 
   4492 ALTER TABLE ONLY stack
   4493     ADD CONSTRAINT "stack_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4494 
   4495 
   4496 --
   4497 -- Name: stack stack_primaryAssetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4498 --
   4499 
   4500 ALTER TABLE ONLY stack
   4501     ADD CONSTRAINT "stack_primaryAssetId_fkey" FOREIGN KEY ("primaryAssetId") REFERENCES asset(id);
   4502 
   4503 
   4504 --
   4505 -- Name: tag_asset tag_asset_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4506 --
   4507 
   4508 ALTER TABLE ONLY tag_asset
   4509     ADD CONSTRAINT "tag_asset_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4510 
   4511 
   4512 --
   4513 -- Name: tag_asset tag_asset_tagId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4514 --
   4515 
   4516 ALTER TABLE ONLY tag_asset
   4517     ADD CONSTRAINT "tag_asset_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES tag(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4518 
   4519 
   4520 --
   4521 -- Name: tag_closure tag_closure_id_ancestor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4522 --
   4523 
   4524 ALTER TABLE ONLY tag_closure
   4525     ADD CONSTRAINT tag_closure_id_ancestor_fkey FOREIGN KEY (id_ancestor) REFERENCES tag(id) ON DELETE CASCADE;
   4526 
   4527 
   4528 --
   4529 -- Name: tag_closure tag_closure_id_descendant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4530 --
   4531 
   4532 ALTER TABLE ONLY tag_closure
   4533     ADD CONSTRAINT tag_closure_id_descendant_fkey FOREIGN KEY (id_descendant) REFERENCES tag(id) ON DELETE CASCADE;
   4534 
   4535 
   4536 --
   4537 -- Name: tag tag_parentId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4538 --
   4539 
   4540 ALTER TABLE ONLY tag
   4541     ADD CONSTRAINT "tag_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES tag(id) ON DELETE CASCADE;
   4542 
   4543 
   4544 --
   4545 -- Name: tag tag_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4546 --
   4547 
   4548 ALTER TABLE ONLY tag
   4549     ADD CONSTRAINT "tag_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4550 
   4551 
   4552 --
   4553 -- Name: user user_clusterGroupId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4554 --
   4555 
   4556 ALTER TABLE ONLY "user"
   4557     ADD CONSTRAINT "user_clusterGroupId_fkey" FOREIGN KEY ("clusterGroupId") REFERENCES cluster_group(id) ON UPDATE CASCADE;
   4558 
   4559 
   4560 --
   4561 -- Name: user_metadata user_metadata_userId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4562 --
   4563 
   4564 ALTER TABLE ONLY user_metadata
   4565     ADD CONSTRAINT "user_metadata_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4566 
   4567 
   4568 --
   4569 -- Name: video_stream_segment video_stream_segment_variantId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4570 --
   4571 
   4572 ALTER TABLE ONLY video_stream_segment
   4573     ADD CONSTRAINT "video_stream_segment_variantId_fkey" FOREIGN KEY ("variantId") REFERENCES video_stream_variant(id) ON DELETE CASCADE;
   4574 
   4575 
   4576 --
   4577 -- Name: video_stream_session video_stream_session_assetId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4578 --
   4579 
   4580 ALTER TABLE ONLY video_stream_session
   4581     ADD CONSTRAINT "video_stream_session_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES asset(id) ON DELETE CASCADE;
   4582 
   4583 
   4584 --
   4585 -- Name: video_stream_variant video_stream_variant_sessionId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4586 --
   4587 
   4588 ALTER TABLE ONLY video_stream_variant
   4589     ADD CONSTRAINT "video_stream_variant_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES video_stream_session(id) ON DELETE CASCADE;
   4590 
   4591 
   4592 --
   4593 -- Name: workflow_log workflow_log_workflowId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4594 --
   4595 
   4596 ALTER TABLE ONLY workflow_log
   4597     ADD CONSTRAINT "workflow_log_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES workflow(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4598 
   4599 
   4600 --
   4601 -- Name: workflow_log workflow_log_workflowStepId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4602 --
   4603 
   4604 ALTER TABLE ONLY workflow_log
   4605     ADD CONSTRAINT "workflow_log_workflowStepId_fkey" FOREIGN KEY ("workflowStepId") REFERENCES workflow_step(id) ON UPDATE CASCADE ON DELETE SET NULL;
   4606 
   4607 
   4608 --
   4609 -- Name: workflow workflow_ownerId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4610 --
   4611 
   4612 ALTER TABLE ONLY workflow
   4613     ADD CONSTRAINT "workflow_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "user"(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4614 
   4615 
   4616 --
   4617 -- Name: workflow_step workflow_step_pluginMethodId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4618 --
   4619 
   4620 ALTER TABLE ONLY workflow_step
   4621     ADD CONSTRAINT "workflow_step_pluginMethodId_fkey" FOREIGN KEY ("pluginMethodId") REFERENCES plugin_method(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4622 
   4623 
   4624 --
   4625 -- Name: workflow_step workflow_step_workflowId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
   4626 --
   4627 
   4628 ALTER TABLE ONLY workflow_step
   4629     ADD CONSTRAINT "workflow_step_workflowId_fkey" FOREIGN KEY ("workflowId") REFERENCES workflow(id) ON UPDATE CASCADE ON DELETE CASCADE;
   4630 
   4631 
   4632 --
   4633 -- PostgreSQL database dump complete
   4634 --
   4635 
   4636 -- \unrestrict mjMyY2YEVBfWGabnjdRqEcQmimigWbvovifIDg4VxfkA30tCaxYDjnokejkP5XZ
   4637