Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| attachment_id | uuid | 2147483647 | null |
|
|
||||||
| submission_id | int8 | 19 | null |
|
|
||||||
| display_filename | varchar | 255 | null |
|
|
||||||
| storage_key | varchar | 64 | null |
|
|
||||||
| validated_mime_type | varchar | 100 | null |
|
|
||||||
| byte_size | int8 | 19 | null |
|
|
||||||
| status | varchar | 16 | 'STAGED'::character varying |
|
|
||||||
| request_token | varchar | 128 | √ | null |
|
|
|||||
| created_at | timestamptz | 35,6 | now() |
|
|
||||||
| removed_at | timestamptz | 35,6 | √ | null |
|
|
|||||
| promotion_role | varchar | 48 | √ | null |
|
|
|||||
| promotion_selected_at | timestamptz | 35,6 | √ | null |
|
|
|||||
| canonical_photo_id | int4 | 10 | √ | null |
|
|
|||||
| promoted_at | timestamptz | 35,6 | √ | null |
|
|
|||||
| comment | text | 2147483647 | √ | null |
|
|
Indexes
| Constraint Name | Type | Sort | Column(s) |
|---|---|---|---|
| tbl_ingestion_attachments_pkey | Primary key | Asc | attachment_id |
| idx_ingestion_attachment_promotion_pending | Performance | Asc/Asc | submission_id + attachment_id |
| idx_ingestion_attachments_submission_created | Performance | Asc/Asc/Asc | submission_id + created_at + attachment_id |
| tbl_ingestion_attachments_storage_key_key | Must be unique | Asc | storage_key |
| uq_ingestion_attachment_canonical_photo | Must be unique | Asc | canonical_photo_id |
| uq_ingestion_attachment_request_token | Must be unique | Asc/Asc | submission_id + request_token |
| uq_ingestion_attachment_submission_role | Must be unique | Asc/Asc | submission_id + promotion_role |
Check Constraints
| Constraint Name | Constraint |
|---|---|
| chk_ingestion_attachment_promotion_link | (((canonical_photo_id IS NULL) AND (promoted_at IS NULL)) OR ((canonical_photo_id IS NOT NULL) AND (promoted_at IS NOT NULL) AND (promotion_role IS NOT NULL) AND ((status)::text = 'STAGED'::text))) |
| chk_ingestion_attachment_removed_not_selected | (((status)::text <> 'REMOVED'::text) OR ((promotion_role IS NULL) AND (promotion_selected_at IS NULL) AND (canonical_photo_id IS NULL) AND (promoted_at IS NULL))) |
| chk_ingestion_attachment_promotion_role | ((promotion_role IS NULL) OR ((promotion_role)::text = ANY ((ARRAY['MEGASTRUCTURE_REFERENCE_IMAGE'::character varying, 'MEGASTRUCTURE_DOCUMENT'::character varying])::text[]))) |
| chk_ingestion_attachment_size | (byte_size > 0) |
| chk_ingestion_attachment_status | ((status)::text = ANY ((ARRAY['STAGED'::character varying, 'REMOVED'::character varying])::text[])) |
| chk_ingestion_attachment_removed_at | ((((status)::text = 'STAGED'::text) AND (removed_at IS NULL)) OR (((status)::text = 'REMOVED'::text) AND (removed_at IS NOT NULL))) |
| chk_ingestion_attachment_selection_time | (((promotion_role IS NULL) AND (promotion_selected_at IS NULL)) OR ((promotion_role IS NOT NULL) AND (promotion_selected_at IS NOT NULL))) |