Changes between Version 8 and Version 9 of TracDev/Proposals/DataModel
- Timestamp:
- Apr 28, 2018, 7:55:44 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracDev/Proposals/DataModel
v8 v9 1 = Trac Data Model Proposal =1 = Trac Data Model Proposal 2 2 3 '''Note:''' ''this was the original rough sketch. See GenericTrac for a later evolution of the proposal.'' 3 {{{#!box info 4 '''Note:''' This was the original rough sketch. See GenericTrac for a later evolution of the proposal. 5 }}} 4 6 5 == The Context == 7 == The Context 8 6 9 Trac stores the data for its resources in various tables, each tailored to a specific situation. 7 10 This leads to a similar variety of APIs in our model modules, to heterogeneous functionality for no good reason etc. All of this has been exposed for a long time, in the TracObjectModelProposal. 8 11 9 More recently, I outlined a way to provide more consistent change tracking and store the authorship of resource modifications in a consistent way,in TracDev/Proposals/Journaling.12 A way to provide more consistent change tracking and store the authorship of resource modifications can be found in TracDev/Proposals/Journaling. 10 13 14 == The Generic Model 11 15 12 == The Generic Model ==16 === Resource Data 13 17 14 === Resource Data === 15 The new model should have a good balance between ''generality'', so that the API can be the same across resources) and ''specificity'' so that the DB load is spread across multiple tables, and additional tables can be easily joined to the generic ones, depending on a module specific need (in particular, the vc layer). 18 The new model should have a good balance between ''generality'', so that the API can be the same across resources) and ''specificity'' so that the database load is spread across multiple tables, and additional tables can be easily joined to the generic ones, depending on a module specific need (in particular, the vc layer). 16 19 17 20 Each resource type could eventually have its own main table, for registering the identity of each object. There are pros/cons for that: … … 28 31 29 32 The property approach is essential for solving some of the main drawbacks of the current model: 30 - overcome the 1:1 limitation of ticket -> milestone, ticket -> component ( btw, components should also become toplevel resources)33 - overcome the 1:1 limitation of ticket -> milestone, ticket -> component (also, components should become top level resources) 31 34 - deal with content in an uniform way; for example, it should be possible to access a wiki page content and a ticket description the same way (see #2945). 32 35 33 36 The property tables above contain a ''snapshot'' of the current values for those objects. They are always updated after a change. 34 37 35 === Resource Change History === 36 Every "transaction" (change to any resource in the system) is tracked in a `<resource>_journal` table, containing an unique identifier for the change `tid`, the date of the change, the authorship information `(author, ip number, authenticated flag)` and the affected resource `id` (*). 38 === Resource Change History 39 40 Every "transaction" (change to any resource in the system) is tracked in a `<resource>_journal` table, containing an unique identifier for the change `tid`, the date of the change, the authorship information `(author, ip number, authenticated flag)` and the affected resource `id`. For dealing with "batch" changes (e.g. #525), there could eventually be a specific extension to this: if the `id` data stored in `<resource>_journal` is NULL, then we'd look in a `<resource>_batch` table, relating the `tid` to (1:N) `id` of resources. 37 41 38 42 For each property table, there will be a corresponding `<resource>_<prop>_history` table, containing the `(tid, name, value)` triples corresponding to what has changed during this transaction. No more ''(old_value, new_value)'' pairs, as this can easily be reconstructed from the full history of changes. … … 44 48 Lastly, there would be a `<resource>_overlay` table for storing old versions of versioned properties themselves, should they ever change. This would be a way to enable editing ticket comments (see #454), and possibly ''version 1'' of commit messages, should they change in the repository itself (#731). 45 49 46 (*) ,,For dealing with "batch" changes (e.g. #525), there could eventually be a specific extension to this: if the `id` data stored in `<resource>_journal` is NULL, then we'd look in a `<resource>_batch` table, relating the `tid` to (1:N) `id` of resources.,,47 48 ''to be continued...''49 50 50 ---- 51 51 See also: TracDev/Proposals, [[TicketQuery(status=!closed&keywords=~tracobject,compact)]]