You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mark documents with the component that created them. #40
Context: I believe there are valid reasons for letting multiple frontend components use the same document type. However, consider the following scenario:
I implement a component <Foo> and use a new document typ something_generic with that component.
I implement another component <Bar>, which happens to fit the exact data model of the something_generic document type – so, I reuse that type.
<Foo> and <Bar> now both save documents of type something_generic.
Problem:<Foo> evolves over time and now requires a completely different data model. <Bar>, however, hasn't changed and isn't expected to. So, I now need a new document type something_else and I need to migrate all <Foo>-related documents to that new type. This is problematic: How can I select and modify all something_generic documents that were created by <Foo>, without affecting those created by <Bar>
Suggested solution: Add a new component column to the document table. When saving a document of type something_generic, the <Foo> component would set component to Foo while <Bar> would set it to Bar. That way, when the above scenario occurs, we can SELECT * FROM documents WHERE type='something_generic' AND component='Foo'; and migrate all those documents to the new something_else type.
Disadvantage: We would be saving an additional field for every document that is never read under normal circumstances.
Alternative solution: Implement the component field on the document_root. With that, we would only have to persist the field once per instance of each component in the frontend.
Activity