Skip to main content
Version: v1.0.0(int)

org.documents

Polymorphic file attachments. Delete-only (no is_active, no updated_at); replacing a file is delete + add.

Columns

ColumnTypeNotes
idUUID PK
org_idUUID FKplatform.organizations(id).
entity_typeorg.entity_document_kindNOT NULL. ENUM (sales_order, purchase_order, work_order). Values added later via ALTER TYPE ADD VALUE.
entity_idUUIDNOT NULL. Id of the row in the corresponding entity table. No DB-level FK — application-enforced cleanup.
nameVARCHAR(255)NOT NULL. Display name shown in the UI.
gcs_pathTEXTNOT NULL. Object path inside the bucket (e.g., orgs/{orgId}/sales-orders/{soId}/{uuid}-{filename}). Signed URLs are generated per request by the Documents L2 component — not stored.
mime_typeVARCHAR(100)Content type at upload time (application/pdf, image/png, etc.).
size_bytesBIGINTFile size in bytes.
created_atTIMESTAMPTZNOT NULL. Default NOW().

Index: (entity_type, entity_id) — supports "all documents for entity X" queries.

Cross-references