Giao diện
identity / media
Trang sinh tự động
Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.
2 bảng. Quay lại identity.
media
P1-11. Uploaded object metadata. Purpose fixes visibility, bucket and the opaque object key; 20 MB cap; PENDING until finalize verifies the stored object; soft delete only. Private objects are read only via short-lived signed URLs issued by the API after a permission check.
public.media · 23 cột · 13 check · 2 unique · 5 index · 22 policy · 9 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
owner_account_id | uuid | NOT NULL | FK → accounts | |
upload_app | app_code | NOT NULL | ||
purpose | text | NOT NULL | ||
visibility | text | NOT NULL | ||
bucket | text | NOT NULL | ||
mime_type | text | NOT NULL | ||
kind | text | NOT NULL | ||
file_ext | text | NOT NULL | ||
original_name | text | NOT NULL | ||
file_name | text | NOT NULL | ||
storage_path | text | NOT NULL | Generated: <purpose-segment>/<id>.<ext>. Never built from client input (no traversal, PD-08 s22). | |
declared_size_bytes | bigint | NOT NULL | ||
size_bytes | bigint | |||
status | text | NOT NULL | ||
ready_at | timestamptz | |||
request_id | uuid | NOT NULL | ||
request_fingerprint | text | NOT NULL | SHA-256 hex of the canonical ticket payload; same request_id with another payload is a conflict. | |
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
version | integer | NOT NULL | ||
deleted_at | timestamptz | |||
deleted_by | uuid | FK → accounts |
Khoá chính: id
Trỏ ra (2):
deleted_by→accounts·ON DELETE RESTRICTowner_account_id→accounts·ON DELETE RESTRICT
Được trỏ tới (15): brands, categories, cod_collections, cod_remittances, content_versions, content_versions, content_versions, fulfillment_events, fulfillment_exceptions, media_uses, product_import_runs, product_import_staged_images, product_media, sale_account_profiles, shipments
media_uses
P1-11. One row per attachment of a media item to a business record. New uses need READY, undeleted media; removal is a set-once marker. Written only by the owning domain service (policies added by that domain).
public.media_uses · 8 cột · 2 check · 1 unique · 3 index · 15 policy · 5 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
media_id | uuid | NOT NULL | FK → media | |
use_type | text | NOT NULL | ||
use_id | uuid | NOT NULL | ||
created_by | uuid | NOT NULL | FK → accounts | |
created_at | timestamptz | NOT NULL | ||
removed_at | timestamptz | |||
removed_by | uuid | FK → accounts |
Khoá chính: id
Trỏ ra (3):
created_by→accounts·ON DELETE RESTRICTmedia_id→media·ON DELETE RESTRICTremoved_by→accounts·ON DELETE RESTRICT
Được trỏ tới (1): product_media