docqai / docq

Private ChatGPT/Perplexity. Securely unlocks knowledge from confidential business information.
https://docqai.github.io/docq/
GNU Affero General Public License v3.0
53 stars 10 forks source link

RFC: [WIP] Change persistence folder structure #211

Open janaka opened 9 months ago

janaka commented 9 months ago

Situation

Data persistence on disk isn't consistently separated by scope of ownership.

Current filesystem structure:

Database table to file mapping:

Tables with joins:

This structure isn't ideal with the addition of Orgs and given upcoming features such as public chatbots and changing the Ask You Docs functionality to be structured as a personal org.

Goals and Requirements

Proposal

Structure folders based on a name for the persistence system followed by one or more keys that identify the unique owner of the data. The filename describes the data.

Pattern:

/{persistance_system_name}/{owner_scope_key_1}/../{owner_scope_key_n}/{filename}

Concrete changes:

New use cases:

janaka commented 9 months ago

Partially implementing as part of #207 as this involves org-scoped data. Partial because migrating existing data structure to the new in deployed systems will not be handled. A new DataScope enum has been introduced with backwards-compatible mappings where needed.