document


Description

{“what”:“A document record with metadata, optional content, and sharing flags.”,“why”:“Without it, documents cannot be persisted or associated with users and collections.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.780962705+00:00”}

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int4 10 √ null
document_bookmark.document_id fk_document_bookmark_document_id C
report_card.document_id fk_report_card_document_id C

{“what”:“Unique integer identifier for the document row.”,“why”:“Without it, rows cannot be referenced or joined uniquely.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.800482694+00:00”}

name text 2147483647 null

{“what”:“Human-readable title of the document, e.g., ‘Q3 Report’.”,“why”:“Without it, users cannot distinguish documents in lists or search results.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.813582599+00:00”}

created_at timestamptz 35,6 now()

{“what”:“UTC timestamp when the document row was inserted.”,“why”:“Without it, audit trails and ordering by creation time are impossible.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.826151206+00:00”}

document text 2147483647 √ null

{“what”:“Full text content of the document; may be null if only metadata.”,“why”:“Without it, the document’s body is unavailable for display or processing.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.843837843+00:00”}

content_type text 2147483647 null

{“what”:“MIME type or format of the document, e.g., ‘text/markdown’.”,“why”:“Without it, clients cannot decide how to render or parse the document.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.861177676+00:00”}

creator_id int4 10 null
core_user.id fk_document_ref_creator_id C

{“what”:“User ID of the account that created the document.”,“why”:“Without it, ownership and access control cannot be enforced.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.874484486+00:00”}

updated_at timestamptz 35,6 now()

{“what”:“UTC timestamp of the last modification to any column.”,“why”:“Without it, change tracking and optimistic concurrency checks fail.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.897590328+00:00”}

collection_id int4 10 √ null
collection.id fk_document_ref_collection_id N

{“what”:“ID of the collection or folder this document belongs to; null if unassigned.”,“why”:“Without it, documents cannot be grouped or navigated hierarchically.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.934970387+00:00”}

archived bool 1 false

{“what”:“Flag indicating whether the document is hidden from normal views.”,“why”:“Without it, archived documents would appear in active lists, breaking user expectations.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.950090036+00:00”}

archived_directly bool 1 √ false

{“what”:“Flag indicating the document was archived by direct action, not via parent collection.”,“why”:“Without it, the reason for archival is ambiguous, affecting restore behavior.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.971338390+00:00”}

entity_id bpchar 21 √ null

{“what”:“Single-character code identifying the entity type, e.g., ‘D’ for document.”,“why”:“Without it, polymorphic references to other entities cannot be resolved.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:49.996253378+00:00”}

last_viewed_at timestamptz 35,6 now()

{“what”:“UTC timestamp of the most recent view by any user.”,“why”:“Without it, recency-based sorting or ‘recently viewed’ features are impossible.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.019349302+00:00”}

view_count int4 10 0

{“what”:“Total number of times the document has been viewed.”,“why”:“Without it, popularity metrics and analytics are unavailable.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.040593559+00:00”}

collection_position int4 10 √ null

{“what”:“Ordinal position of the document within its collection, starting at 0.”,“why”:“Without it, manual ordering of documents in a collection is lost.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.059178016+00:00”}

dependency_analysis_version int2 5 0

{“what”:“Version number of the dependency analysis run on this document; 0 means none.”,“why”:“Without it, stale analysis results cannot be detected or invalidated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.079383841+00:00”}

public_uuid varchar 254 √ null

{“what”:“UUID string used for public sharing links; null if not shared.”,“why”:“Without it, public access cannot be granted or revoked.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.092553430+00:00”}

made_public_by_id int4 10 √ null
core_user.id fk_document_made_public_by_id C

{“what”:“User ID of the person who made the document public.”,“why”:“Without it, audit trail for public sharing is incomplete.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.120354127+00:00”}

public_uuid_prefix varchar 36 √ null

{“what”:“Short prefix of the public UUID for display or routing.”,“why”:“Without it, shortened public links cannot be generated or validated.”,“by”:“fleet-annotator-worker”,“at”:“2026-09-23T00:03:50.133121408+00:00”}

Indexes

Constraint Name Type Sort Column(s)
document_pkey Primary key Asc id
document_entity_id_key Must be unique Asc entity_id
idx_document_collection_id Performance Asc collection_id
idx_document_creator_id Performance Asc creator_id
idx_document_dependency_analysis_version Performance Asc dependency_analysis_version
idx_document_made_public_by_id Performance Asc made_public_by_id
idx_document_public_uuid Must be unique Asc public_uuid
idx_document_public_uuid_prefix Performance Asc public_uuid_prefix

Relationships