Skip to content

Documents Schema

Core document records with storage, retention, and lifecycle management.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
user_iduuidNO
nametextNO
descriptiontextYES
category_iduuidYES
status_iduuidYES
storage_pathtextNO
storage_locationtextNO'supabase'
file_typetextNO
file_sizebigintNO0
is_archivedbooleanNOfalse
is_expiredbooleanNOfalse
retention_daysintegerYES
retention_actiontextYES
expired_attimestamptzYES
metadatajsonbYES'{}'
created_attimestamptzNOnow()
updated_attimestamptzNOnow()

Versioned file uploads for documents.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
user_iduuidNO
storage_pathtextNO
storage_locationtextNO'supabase'
version_numberintegerNO
file_sizebigintNO0
created_attimestamptzNOnow()

Hierarchical document categories.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
user_iduuidNO
nametextNO
descriptiontextYES
parent_iduuidYES
sort_ordersmallintNO0
created_attimestamptzNOnow()
updated_attimestamptzNOnow()

Custom workflow statuses for documents.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
user_iduuidNO
nametextNO
color_codetextNO'#6366f1'
descriptiontextYES
is_defaultbooleanNOfalse
sort_ordersmallintNO0
created_attimestamptzNOnow()
updated_attimestamptzNOnow()

Document sharing with permission levels.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
shared_with_iduuidNO
permissiontextNO'view'
is_time_boundbooleanNOfalse
starts_attimestamptzYES
expires_attimestamptzYES
created_byuuidNO
created_attimestamptzNOnow()

Public shareable links for documents.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
link_codetextNO
password_hashtextYES
allow_downloadbooleanNOtrue
expires_attimestamptzYES
created_byuuidNO
created_attimestamptzNOnow()
updated_attimestamptzNOnow()

Comments on documents.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
user_iduuidNO
contenttextNO
created_attimestamptzNOnow()
updated_attimestamptzNOnow()

Key-value metadata on documents.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
keytextNO
valuetextYES
created_attimestamptzNOnow()

Audit log for document operations.

ColumnTypeNullableDefault
iduuidNOgen_random_uuid()
document_iduuidNO
user_iduuidNO
operationtextNO
detailsjsonbYES'{}'
created_attimestamptzNOnow()