Mark documents with the component that created them. #41
Replies: 1 comment 1 reply
-
|
An alternative approach: That same transition from one document type to another could also be handled by the frontend. This will be a rare case anyway, so it wouldn't be a big issue to have some legacy handling here and there. The one thing that could make this issue more frequent is users wanting to implement custom document-based components without wanting to have to fork the API, since their changes to the API (to accommodate a new document typ). My original idea, together with some rather generic document types, is one way to mitigate this limitation. A more elegant approach would be to include this question in the discussion outlined here: GBSL-Informatik/teaching-dev#150. Basically, we would just need to provide an interface that lets users include custom document types in a file that likely won't be affected by a future upgrade from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Context: I believe there are valid reasons for letting multiple frontend components use the same document type. However, consider the following scenario:
<Foo>and use a new document typsomething_genericwith that component.<Bar>, which happens to fit the exact data model of thesomething_genericdocument type – so, I reuse that type.<Foo>and<Bar>now both save documents of typesomething_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 typesomething_elseand I need to migrate all<Foo>-related documents to that new type. This is problematic: How can I select and modify allsomething_genericdocuments that were created by<Foo>, without affecting those created by<Bar>Suggested solution: Add a new
componentcolumn to thedocumenttable. When saving a document of typesomething_generic, the<Foo>component would setcomponenttoFoowhile<Bar>would set it toBar. That way, when the above scenario occurs, we canSELECT * FROM documents WHERE type='something_generic' AND component='Foo';and migrate all those documents to the newsomething_elsetype.Disadvantage: We would be saving an additional field for every document that is never read under normal circumstances.
Alternative solution: Implement the
componentfield on thedocument_root. With that, we would only have to persist the field once per instance of each component in the frontend.Beta Was this translation helpful? Give feedback.
All reactions