{ "id": "5f74d5ee-94c3-45c2-b187-22a9f1f14a9e", "prevId": "1a6952f3-4c88-44e3-b7d8-0194dcbd054b", "version": "7", "dialect": "postgresql", "tables": { "public.activity_events": { "name": "activity_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "event_type": { "name": "event_type", "type": "text", "primaryKey": false, "notNull": true }, "immich_album_id": { "name": "immich_album_id", "type": "text", "primaryKey": false, "notNull": false }, "immich_asset_id": { "name": "immich_asset_id", "type": "text", "primaryKey": false, "notNull": false }, "query": { "name": "query", "type": "text", "primaryKey": false, "notNull": false }, "occurred_at": { "name": "occurred_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "activity_events_occurred_at_idx": { "name": "activity_events_occurred_at_idx", "columns": [ { "expression": "occurred_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "activity_events_editorial_occurred_idx": { "name": "activity_events_editorial_occurred_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "occurred_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "activity_events_type_occurred_idx": { "name": "activity_events_type_occurred_idx", "columns": [ { "expression": "event_type", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "occurred_at", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "activity_events_editorial_account_id_editorial_accounts_id_fk": { "name": "activity_events_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "activity_events", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "activity_events_event_type_check": { "name": "activity_events_event_type_check", "value": "\"activity_events\".\"event_type\" in ('album_view', 'search', 'lightbox_view')" } }, "isRLSEnabled": false }, "public.album_grants": { "name": "album_grants", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "immich_album_id": { "name": "immich_album_id", "type": "text", "primaryKey": false, "notNull": true }, "granted_at": { "name": "granted_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "revoked_at": { "name": "revoked_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "granted_by_user_id": { "name": "granted_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "source": { "name": "source", "type": "text", "primaryKey": false, "notNull": true, "default": "'admin'" } }, "indexes": { "album_grants_editorial_account_id_idx": { "name": "album_grants_editorial_account_id_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "album_grants_immich_album_id_idx": { "name": "album_grants_immich_album_id_idx", "columns": [ { "expression": "immich_album_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "album_grants_editorial_active_album_unique": { "name": "album_grants_editorial_active_album_unique", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "lower(\"immich_album_id\")", "asc": true, "isExpression": true, "nulls": "last" } ], "isUnique": true, "where": "\"album_grants\".\"revoked_at\" is null", "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "album_grants_editorial_account_id_editorial_accounts_id_fk": { "name": "album_grants_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "album_grants", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "album_grants_granted_by_user_id_user_id_fk": { "name": "album_grants_granted_by_user_id_user_id_fk", "tableFrom": "album_grants", "tableTo": "user", "columnsFrom": [ "granted_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "album_grants_immich_album_id_uuid_check": { "name": "album_grants_immich_album_id_uuid_check", "value": "\"album_grants\".\"immich_album_id\" ~* '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" }, "album_grants_source_check": { "name": "album_grants_source_check", "value": "\"album_grants\".\"source\" in ('admin', 'auto_rule', 'self_service')" } }, "isRLSEnabled": false }, "public.announcements": { "name": "announcements", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "message": { "name": "message", "type": "text", "primaryKey": false, "notNull": true }, "event_date": { "name": "event_date", "type": "date", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "announcements_created_by_user_id_user_id_fk": { "name": "announcements_created_by_user_id_user_id_fk", "tableFrom": "announcements", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.audit_events": { "name": "audit_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "event_type": { "name": "event_type", "type": "text", "primaryKey": false, "notNull": true }, "actor_user_id": { "name": "actor_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "actor_type": { "name": "actor_type", "type": "text", "primaryKey": false, "notNull": true, "default": "'system'" }, "entity_type": { "name": "entity_type", "type": "text", "primaryKey": false, "notNull": true }, "entity_id": { "name": "entity_id", "type": "text", "primaryKey": false, "notNull": true }, "previous_values": { "name": "previous_values", "type": "jsonb", "primaryKey": false, "notNull": false }, "new_values": { "name": "new_values", "type": "jsonb", "primaryKey": false, "notNull": false }, "occurred_at": { "name": "occurred_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "request_id": { "name": "request_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "audit_events_actor_user_id_user_id_fk": { "name": "audit_events_actor_user_id_user_id_fk", "tableFrom": "audit_events", "tableTo": "user", "columnsFrom": [ "actor_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.account": { "name": "account", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "account_id": { "name": "account_id", "type": "text", "primaryKey": false, "notNull": true }, "provider_id": { "name": "provider_id", "type": "text", "primaryKey": false, "notNull": true }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "access_token": { "name": "access_token", "type": "text", "primaryKey": false, "notNull": false }, "refresh_token": { "name": "refresh_token", "type": "text", "primaryKey": false, "notNull": false }, "id_token": { "name": "id_token", "type": "text", "primaryKey": false, "notNull": false }, "access_token_expires_at": { "name": "access_token_expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "refresh_token_expires_at": { "name": "refresh_token_expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "scope": { "name": "scope", "type": "text", "primaryKey": false, "notNull": false }, "password": { "name": "password", "type": "text", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "account_user_id_user_id_fk": { "name": "account_user_id_user_id_fk", "tableFrom": "account", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.session": { "name": "session", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "ip_address": { "name": "ip_address", "type": "text", "primaryKey": false, "notNull": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true } }, "indexes": {}, "foreignKeys": { "session_user_id_user_id_fk": { "name": "session_user_id_user_id_fk", "tableFrom": "session", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "session_token_unique": { "name": "session_token_unique", "nullsNotDistinct": false, "columns": [ "token" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.two_factor": { "name": "two_factor", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "secret": { "name": "secret", "type": "text", "primaryKey": false, "notNull": true }, "backup_codes": { "name": "backup_codes", "type": "text", "primaryKey": false, "notNull": false }, "verified": { "name": "verified", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "failed_verification_count": { "name": "failed_verification_count", "type": "integer", "primaryKey": false, "notNull": true, "default": 0 }, "locked_until": { "name": "locked_until", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "two_factor_user_id_user_id_fk": { "name": "two_factor_user_id_user_id_fk", "tableFrom": "two_factor", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "two_factor_user_id_unique": { "name": "two_factor_user_id_unique", "nullsNotDistinct": false, "columns": [ "user_id" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.user": { "name": "user", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true }, "email_verified": { "name": "email_verified", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "image": { "name": "image", "type": "text", "primaryKey": false, "notNull": false }, "role": { "name": "role", "type": "portal_role", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'EDITORIAL'" }, "two_factor_enabled": { "name": "two_factor_enabled", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": { "user_email_unique": { "name": "user_email_unique", "nullsNotDistinct": false, "columns": [ "email" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.verification": { "name": "verification", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "identifier": { "name": "identifier", "type": "text", "primaryKey": false, "notNull": true }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true }, "expires_at": { "name": "expires_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.album_auto_rules": { "name": "album_auto_rules", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "keyword": { "name": "keyword", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": { "album_auto_rules_editorial_account_id_keyword_idx": { "name": "album_auto_rules_editorial_account_id_keyword_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "lower(\"keyword\")", "asc": true, "isExpression": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "album_auto_rules_editorial_account_id_editorial_accounts_id_fk": { "name": "album_auto_rules_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "album_auto_rules", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "album_auto_rules_created_by_user_id_user_id_fk": { "name": "album_auto_rules_created_by_user_id_user_id_fk", "tableFrom": "album_auto_rules", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.billing_report_items": { "name": "billing_report_items", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "billing_report_id": { "name": "billing_report_id", "type": "uuid", "primaryKey": false, "notNull": true }, "usage_id": { "name": "usage_id", "type": "uuid", "primaryKey": false, "notNull": true }, "immich_asset_id_snapshot": { "name": "immich_asset_id_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "filename_snapshot": { "name": "filename_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "album_name_snapshot": { "name": "album_name_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "purpose_snapshot": { "name": "purpose_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "internal_reference_snapshot": { "name": "internal_reference_snapshot", "type": "text", "primaryKey": false, "notNull": false }, "price_cents": { "name": "price_cents", "type": "integer", "primaryKey": false, "notNull": true }, "collab": { "name": "collab", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "billing_report_items_report_usage_unique": { "name": "billing_report_items_report_usage_unique", "columns": [ { "expression": "billing_report_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "usage_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "billing_report_items_billing_report_id_billing_reports_id_fk": { "name": "billing_report_items_billing_report_id_billing_reports_id_fk", "tableFrom": "billing_report_items", "tableTo": "billing_reports", "columnsFrom": [ "billing_report_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "billing_report_items_usage_id_usages_id_fk": { "name": "billing_report_items_usage_id_usages_id_fk", "tableFrom": "billing_report_items", "tableTo": "usages", "columnsFrom": [ "usage_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.billing_reports": { "name": "billing_reports", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "report_number": { "name": "report_number", "type": "integer", "primaryKey": false, "notNull": true }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "period_starts_at": { "name": "period_starts_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "period_ends_at": { "name": "period_ends_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true }, "billing_address_snapshot": { "name": "billing_address_snapshot", "type": "jsonb", "primaryKey": false, "notNull": true }, "invoice_number": { "name": "invoice_number", "type": "text", "primaryKey": false, "notNull": false }, "net_total_cents": { "name": "net_total_cents", "type": "integer", "primaryKey": false, "notNull": true }, "flatrate_cents_snapshot": { "name": "flatrate_cents_snapshot", "type": "integer", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "report_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'draft'" }, "pdf": { "name": "pdf", "type": "bytea", "primaryKey": false, "notNull": false }, "pdf_sha256": { "name": "pdf_sha256", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "invoice_pdf": { "name": "invoice_pdf", "type": "bytea", "primaryKey": false, "notNull": false }, "invoice_pdf_sha256": { "name": "invoice_pdf_sha256", "type": "varchar(64)", "primaryKey": false, "notNull": false }, "invoice_pdf_filename": { "name": "invoice_pdf_filename", "type": "text", "primaryKey": false, "notNull": false }, "invoice_uploaded_at": { "name": "invoice_uploaded_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "invoice_email_status": { "name": "invoice_email_status", "type": "text", "primaryKey": false, "notNull": true, "default": "'not_sent'" }, "invoice_email_sent_at": { "name": "invoice_email_sent_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "invoice_email_error": { "name": "invoice_email_error", "type": "text", "primaryKey": false, "notNull": false }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "finalized_at": { "name": "finalized_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "cancelled_at": { "name": "cancelled_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "cancellation_reason": { "name": "cancellation_reason", "type": "text", "primaryKey": false, "notNull": false }, "cancelled_by_user_id": { "name": "cancelled_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": { "billing_reports_report_number_unique": { "name": "billing_reports_report_number_unique", "columns": [ { "expression": "report_number", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} }, "billing_reports_invoice_number_unique": { "name": "billing_reports_invoice_number_unique", "columns": [ { "expression": "invoice_number", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "billing_reports_editorial_account_id_editorial_accounts_id_fk": { "name": "billing_reports_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "billing_reports", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "billing_reports_created_by_user_id_user_id_fk": { "name": "billing_reports_created_by_user_id_user_id_fk", "tableFrom": "billing_reports", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "billing_reports_cancelled_by_user_id_user_id_fk": { "name": "billing_reports_cancelled_by_user_id_user_id_fk", "tableFrom": "billing_reports", "tableTo": "user", "columnsFrom": [ "cancelled_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "billing_reports_pdf_sha256_hex_check": { "name": "billing_reports_pdf_sha256_hex_check", "value": "\"billing_reports\".\"pdf_sha256\" ~ '^[0-9a-f]{64}$'" }, "billing_reports_invoice_pdf_sha256_hex_check": { "name": "billing_reports_invoice_pdf_sha256_hex_check", "value": "\"billing_reports\".\"invoice_pdf_sha256\" IS NULL OR \"billing_reports\".\"invoice_pdf_sha256\" ~ '^[0-9a-f]{64}$'" }, "billing_reports_invoice_email_status_check": { "name": "billing_reports_invoice_email_status_check", "value": "\"billing_reports\".\"invoice_email_status\" in ('not_sent', 'sent', 'failed')" }, "billing_reports_final_pdf_check": { "name": "billing_reports_final_pdf_check", "value": "\"billing_reports\".\"status\" <> 'final' OR (\"billing_reports\".\"pdf\" IS NOT NULL AND \"billing_reports\".\"pdf_sha256\" IS NOT NULL)" } }, "isRLSEnabled": false }, "public.calendar_events": { "name": "calendar_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true }, "event_date": { "name": "event_date", "type": "date", "primaryKey": false, "notNull": true }, "immich_album_id": { "name": "immich_album_id", "type": "text", "primaryKey": false, "notNull": false }, "category_id": { "name": "category_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": {}, "foreignKeys": { "calendar_events_category_id_event_categories_id_fk": { "name": "calendar_events_category_id_event_categories_id_fk", "tableFrom": "calendar_events", "tableTo": "event_categories", "columnsFrom": [ "category_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "calendar_events_created_by_user_id_user_id_fk": { "name": "calendar_events_created_by_user_id_user_id_fk", "tableFrom": "calendar_events", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.event_categories": { "name": "event_categories", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "color": { "name": "color", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": { "event_categories_name_lower_unique": { "name": "event_categories_name_lower_unique", "columns": [ { "expression": "lower(\"name\")", "asc": true, "isExpression": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "event_categories_created_by_user_id_user_id_fk": { "name": "event_categories_created_by_user_id_user_id_fk", "tableFrom": "event_categories", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "event_categories_color_check": { "name": "event_categories_color_check", "value": "\"event_categories\".\"color\" in ('blue', 'green', 'orange', 'purple', 'teal', 'gold', 'red', 'neutral')" } }, "isRLSEnabled": false }, "public.event_reservations": { "name": "event_reservations", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "event_id": { "name": "event_id", "type": "uuid", "primaryKey": false, "notNull": true }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "granted_at": { "name": "granted_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false } }, "indexes": { "event_reservations_event_editorial_unique": { "name": "event_reservations_event_editorial_unique", "columns": [ { "expression": "event_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "event_reservations_event_id_calendar_events_id_fk": { "name": "event_reservations_event_id_calendar_events_id_fk", "tableFrom": "event_reservations", "tableTo": "calendar_events", "columnsFrom": [ "event_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "event_reservations_editorial_account_id_editorial_accounts_id_fk": { "name": "event_reservations_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "event_reservations", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.event_responses": { "name": "event_responses", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "event_id": { "name": "event_id", "type": "uuid", "primaryKey": false, "notNull": true }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "text", "primaryKey": false, "notNull": true }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "event_responses_event_editorial_unique": { "name": "event_responses_event_editorial_unique", "columns": [ { "expression": "event_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "event_responses_event_id_calendar_events_id_fk": { "name": "event_responses_event_id_calendar_events_id_fk", "tableFrom": "event_responses", "tableTo": "calendar_events", "columnsFrom": [ "event_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "event_responses_editorial_account_id_editorial_accounts_id_fk": { "name": "event_responses_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "event_responses", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "event_responses_status_check": { "name": "event_responses_status_check", "value": "\"event_responses\".\"status\" in ('attending', 'not_attending')" } }, "isRLSEnabled": false }, "public.billing_address_versions": { "name": "billing_address_versions", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "company_name": { "name": "company_name", "type": "text", "primaryKey": false, "notNull": true }, "contact_name": { "name": "contact_name", "type": "text", "primaryKey": false, "notNull": true }, "address_line_1": { "name": "address_line_1", "type": "text", "primaryKey": false, "notNull": true }, "address_line_2": { "name": "address_line_2", "type": "text", "primaryKey": false, "notNull": false }, "postal_code": { "name": "postal_code", "type": "text", "primaryKey": false, "notNull": true }, "city": { "name": "city", "type": "text", "primaryKey": false, "notNull": true }, "country_code": { "name": "country_code", "type": "text", "primaryKey": false, "notNull": true }, "valid_from": { "name": "valid_from", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "superseded_by_id": { "name": "superseded_by_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "billing_address_versions_editorial_account_id_editorial_accounts_id_fk": { "name": "billing_address_versions_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "billing_address_versions", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "billing_address_versions_superseded_by_id_billing_address_versions_id_fk": { "name": "billing_address_versions_superseded_by_id_billing_address_versions_id_fk", "tableFrom": "billing_address_versions", "tableTo": "billing_address_versions", "columnsFrom": [ "superseded_by_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "billing_address_versions_created_by_user_id_user_id_fk": { "name": "billing_address_versions_created_by_user_id_user_id_fk", "tableFrom": "billing_address_versions", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.editorial_accounts": { "name": "editorial_accounts", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "user_id": { "name": "user_id", "type": "uuid", "primaryKey": false, "notNull": true }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true }, "contact_name": { "name": "contact_name", "type": "text", "primaryKey": false, "notNull": true }, "login_email": { "name": "login_email", "type": "text", "primaryKey": false, "notNull": true }, "status": { "name": "status", "type": "account_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'pending_email'" }, "current_price_cents": { "name": "current_price_cents", "type": "integer", "primaryKey": false, "notNull": false }, "flatrate_active": { "name": "flatrate_active", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "flatrate_price_cents": { "name": "flatrate_price_cents", "type": "integer", "primaryKey": false, "notNull": false }, "flatrate_asset_limit": { "name": "flatrate_asset_limit", "type": "integer", "primaryKey": false, "notNull": false }, "collab_enabled": { "name": "collab_enabled", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "approval_notice_status": { "name": "approval_notice_status", "type": "text", "primaryKey": false, "notNull": true, "default": "'not_requested'" }, "current_billing_address_version_id": { "name": "current_billing_address_version_id", "type": "uuid", "primaryKey": false, "notNull": false }, "email_verified_at": { "name": "email_verified_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "accepted_terms_version": { "name": "accepted_terms_version", "type": "text", "primaryKey": false, "notNull": false }, "accepted_terms_at": { "name": "accepted_terms_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "privacy_acknowledged_at": { "name": "privacy_acknowledged_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "archived_at": { "name": "archived_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "archived_by_user_id": { "name": "archived_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": { "editorial_accounts_user_id_user_id_fk": { "name": "editorial_accounts_user_id_user_id_fk", "tableFrom": "editorial_accounts", "tableTo": "user", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "editorial_accounts_current_billing_address_version_id_billing_address_versions_id_fk": { "name": "editorial_accounts_current_billing_address_version_id_billing_address_versions_id_fk", "tableFrom": "editorial_accounts", "tableTo": "billing_address_versions", "columnsFrom": [ "current_billing_address_version_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "editorial_accounts_archived_by_user_id_user_id_fk": { "name": "editorial_accounts_archived_by_user_id_user_id_fk", "tableFrom": "editorial_accounts", "tableTo": "user", "columnsFrom": [ "archived_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "editorial_accounts_user_id_unique": { "name": "editorial_accounts_user_id_unique", "nullsNotDistinct": false, "columns": [ "user_id" ] }, "editorial_accounts_login_email_unique": { "name": "editorial_accounts_login_email_unique", "nullsNotDistinct": false, "columns": [ "login_email" ] } }, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.lightbox_items": { "name": "lightbox_items", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "asset_id": { "name": "asset_id", "type": "text", "primaryKey": false, "notNull": true }, "added_at": { "name": "added_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "lightbox_items_editorial_asset_idx": { "name": "lightbox_items_editorial_asset_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "asset_id", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "lightbox_items_editorial_account_id_editorial_accounts_id_fk": { "name": "lightbox_items_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "lightbox_items", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.rate_limits": { "name": "rate_limits", "schema": "", "columns": { "key": { "name": "key", "type": "text", "primaryKey": false, "notNull": true }, "window_boundary": { "name": "window_boundary", "type": "integer", "primaryKey": false, "notNull": true }, "count": { "name": "count", "type": "integer", "primaryKey": false, "notNull": true, "default": 1 }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "updated_at": { "name": "updated_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": { "rate_limits_key_window_boundary_pk": { "name": "rate_limits_key_window_boundary_pk", "columns": [ "key", "window_boundary" ] } }, "uniqueConstraints": {}, "policies": {}, "checkConstraints": {}, "isRLSEnabled": false }, "public.release_notes": { "name": "release_notes", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "version": { "name": "version", "type": "text", "primaryKey": false, "notNull": true }, "audience": { "name": "audience", "type": "text", "primaryKey": false, "notNull": true, "default": "'both'" }, "body": { "name": "body", "type": "text", "primaryKey": false, "notNull": true }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "created_by_user_id": { "name": "created_by_user_id", "type": "uuid", "primaryKey": false, "notNull": false } }, "indexes": { "release_notes_version_audience_unique": { "name": "release_notes_version_audience_unique", "columns": [ { "expression": "version", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "audience", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "release_notes_created_by_user_id_user_id_fk": { "name": "release_notes_created_by_user_id_user_id_fk", "tableFrom": "release_notes", "tableTo": "user", "columnsFrom": [ "created_by_user_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "release_notes_audience_check": { "name": "release_notes_audience_check", "value": "\"release_notes\".\"audience\" in ('admin', 'editorial', 'both')" }, "release_notes_version_check": { "name": "release_notes_version_check", "value": "\"release_notes\".\"version\" ~ '^[0-9]+\\.[0-9]+(\\.[0-9]+)?$'" } }, "isRLSEnabled": false }, "public.download_events": { "name": "download_events", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "usage_id": { "name": "usage_id", "type": "uuid", "primaryKey": false, "notNull": true }, "immich_asset_id": { "name": "immich_asset_id", "type": "text", "primaryKey": false, "notNull": true }, "authorized_at": { "name": "authorized_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" }, "started_at": { "name": "started_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "completed_at": { "name": "completed_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": false }, "status": { "name": "status", "type": "download_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'authorized'" }, "transferred_bytes": { "name": "transferred_bytes", "type": "bigint", "primaryKey": false, "notNull": false }, "repeat_download_note": { "name": "repeat_download_note", "type": "text", "primaryKey": false, "notNull": false }, "request_id": { "name": "request_id", "type": "uuid", "primaryKey": false, "notNull": true }, "idempotency_key": { "name": "idempotency_key", "type": "text", "primaryKey": false, "notNull": true }, "intent_kind": { "name": "intent_kind", "type": "text", "primaryKey": false, "notNull": true, "default": "'new_usage'" }, "request_fingerprint": { "name": "request_fingerprint", "type": "varchar(64)", "primaryKey": false, "notNull": true }, "legacy_intent": { "name": "legacy_intent", "type": "boolean", "primaryKey": false, "notNull": true, "default": false } }, "indexes": { "download_events_editorial_authorized_id_idx": { "name": "download_events_editorial_authorized_id_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "authorized_at", "isExpression": false, "asc": false, "nulls": "last" }, { "expression": "id", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "download_events_editorial_idempotency_key_unique": { "name": "download_events_editorial_idempotency_key_unique", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "idempotency_key", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": true, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "download_events_editorial_account_id_editorial_accounts_id_fk": { "name": "download_events_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "download_events", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "download_events_usage_id_usages_id_fk": { "name": "download_events_usage_id_usages_id_fk", "tableFrom": "download_events", "tableTo": "usages", "columnsFrom": [ "usage_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "download_events_intent_kind_check": { "name": "download_events_intent_kind_check", "value": "\"download_events\".\"intent_kind\" in ('new_usage', 'repeat_download', 'legacy')" }, "download_events_request_fingerprint_hex_check": { "name": "download_events_request_fingerprint_hex_check", "value": "\"download_events\".\"request_fingerprint\" ~ '^[0-9a-f]{64}$'" }, "download_events_canonical_idempotency_key_check": { "name": "download_events_canonical_idempotency_key_check", "value": "\"download_events\".\"legacy_intent\" OR \"download_events\".\"idempotency_key\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" }, "download_events_canonical_immich_asset_id_check": { "name": "download_events_canonical_immich_asset_id_check", "value": "\"download_events\".\"immich_asset_id\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" } }, "isRLSEnabled": false }, "public.usages": { "name": "usages", "schema": "", "columns": { "id": { "name": "id", "type": "uuid", "primaryKey": true, "notNull": true, "default": "gen_random_uuid()" }, "editorial_account_id": { "name": "editorial_account_id", "type": "uuid", "primaryKey": false, "notNull": true }, "immich_asset_id": { "name": "immich_asset_id", "type": "text", "primaryKey": false, "notNull": true }, "filename_snapshot": { "name": "filename_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "immich_album_id_snapshot": { "name": "immich_album_id_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "album_name_snapshot": { "name": "album_name_snapshot", "type": "text", "primaryKey": false, "notNull": true }, "purpose": { "name": "purpose", "type": "text", "primaryKey": false, "notNull": true }, "internal_reference": { "name": "internal_reference", "type": "text", "primaryKey": false, "notNull": false }, "price_cents": { "name": "price_cents", "type": "integer", "primaryKey": false, "notNull": true }, "collab": { "name": "collab", "type": "boolean", "primaryKey": false, "notNull": true, "default": false }, "billing_status": { "name": "billing_status", "type": "usage_billing_status", "typeSchema": "public", "primaryKey": false, "notNull": true, "default": "'open'" }, "billing_report_id": { "name": "billing_report_id", "type": "uuid", "primaryKey": false, "notNull": false }, "created_at": { "name": "created_at", "type": "timestamp with time zone", "primaryKey": false, "notNull": true, "default": "now()" } }, "indexes": { "usages_editorial_created_id_idx": { "name": "usages_editorial_created_id_idx", "columns": [ { "expression": "editorial_account_id", "isExpression": false, "asc": true, "nulls": "last" }, { "expression": "created_at", "isExpression": false, "asc": false, "nulls": "last" }, { "expression": "id", "isExpression": false, "asc": false, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} }, "usages_created_at_idx": { "name": "usages_created_at_idx", "columns": [ { "expression": "created_at", "isExpression": false, "asc": true, "nulls": "last" } ], "isUnique": false, "concurrently": false, "method": "btree", "with": {} } }, "foreignKeys": { "usages_editorial_account_id_editorial_accounts_id_fk": { "name": "usages_editorial_account_id_editorial_accounts_id_fk", "tableFrom": "usages", "tableTo": "editorial_accounts", "columnsFrom": [ "editorial_account_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" }, "usages_billing_report_id_billing_reports_id_fk": { "name": "usages_billing_report_id_billing_reports_id_fk", "tableFrom": "usages", "tableTo": "billing_reports", "columnsFrom": [ "billing_report_id" ], "columnsTo": [ "id" ], "onDelete": "restrict", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "policies": {}, "checkConstraints": { "usages_canonical_immich_asset_id_check": { "name": "usages_canonical_immich_asset_id_check", "value": "\"usages\".\"immich_asset_id\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" }, "usages_canonical_immich_album_id_check": { "name": "usages_canonical_immich_album_id_check", "value": "\"usages\".\"immich_album_id_snapshot\" ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'" } }, "isRLSEnabled": false } }, "enums": { "public.portal_role": { "name": "portal_role", "schema": "public", "values": [ "ADMIN", "EDITORIAL" ] }, "public.report_status": { "name": "report_status", "schema": "public", "values": [ "draft", "final", "cancelled" ] }, "public.account_status": { "name": "account_status", "schema": "public", "values": [ "pending_email", "pending_approval", "active", "suspended", "rejected" ] }, "public.download_status": { "name": "download_status", "schema": "public", "values": [ "authorized", "streaming", "completed", "failed_before_delivery", "interrupted" ] }, "public.usage_billing_status": { "name": "usage_billing_status", "schema": "public", "values": [ "open", "billed", "reopened", "voided" ] } }, "schemas": {}, "sequences": {}, "roles": {}, "policies": {}, "views": {}, "_meta": { "columns": {}, "schemas": {}, "tables": {} } }