Dropbox-style file storage & sync database schema

How a cloud drive models its data: a folder tree, versioned files, content-addressed blocks that deduplicate identical uploads to a single copy, shares and expiring public links, per-device sync cursors, trash retention and quota accounting.

Dropbox File Storage ER diagram

Dropbox-style file storage & sync database schema 11 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 11 users idBIGINT emailVARCHAR display_nameVARCHAR password_hashVARCHAR root_folder_idBIGINT quota_bytesBIGINT is_suspendedBOOLEAN created_atTIMESTAMPTZ folders idBIGINT owner_idBIGINT parent_idBIGINT nameVARCHAR path_depthINTEGER deleted_atTIMESTAMPTZ created_atTIMESTAMPTZ updated_atTIMESTAMPTZ files idBIGINT owner_idBIGINT folder_idBIGINT current_version_idBIGINT nameVARCHAR content_typeVARCHAR is_lockedBOOLEAN deleted_atTIMESTAMPTZ created_atTIMESTAMPTZ updated_atTIMESTAMPTZ file_versions idBIGINT file_idBIGINT version_numberINTEGER author_idBIGINT size_bytesBIGINT content_hashCHAR device_idBIGINT created_atTIMESTAMPTZ blocks idBIGINT hashCHAR size_bytesINTEGER storage_keyVARCHAR ref_countINTEGER storage_classVARCHAR created_atTIMESTAMPTZ file_version_blocks version_idBIGINT block_indexINTEGER block_idBIGINT shares idBIGINT file_idBIGINT folder_idBIGINT grantee_idBIGINT granted_by_idBIGINT permissionVARCHAR accepted_atTIMESTAMPTZ created_atTIMESTAMPTZ public_links idBIGINT tokenVARCHAR file_idBIGINT folder_idBIGINT created_by_idBIGINT password_hashVARCHAR allow_uploadBOOLEAN expires_atTIMESTAMPTZ max_downloadsINTEGER download_countINTEGER revoked_atTIMESTAMPTZ created_atTIMESTAMPTZ devices idBIGINT user_idBIGINT nameVARCHAR platformVARCHAR sync_cursorBIGINT last_seen_atTIMESTAMPTZ revoked_atTIMESTAMPTZ created_atTIMESTAMPTZ sync_events idBIGSERIAL user_idBIGINT file_idBIGINT folder_idBIGINT actionVARCHAR actor_device_idBIGINT created_atTIMESTAMPTZ trash_items idBIGINT owner_idBIGINT file_idBIGINT folder_idBIGINT original_folder_idBIGINT original_nameVARCHAR deleted_by_idBIGINT purge_afterTIMESTAMPTZ deleted_atTIMESTAMPTZ storage_usage user_idBIGINT logical_bytesBIGINT physical_bytesBIGINT file_countINTEGER version_bytesBIGINT recalculated_atTIMESTAMPTZ

Related database schemas