Changes between Version 44 and Version 45 of GenericTrac
- Timestamp:
- Nov 27, 2014, 10:30:51 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenericTrac
v44 v45 17 17 in which the storage of changes is quite cumbersome (see #454, #6466) 18 18 - solve a few design problems with the current data model (like #1890, #4582) 19 - allow better code reuse and shar eof the base features19 - allow better code reuse and sharing of the base features 20 20 among different kinds of resources (like #695, #1113, and a lot more, 21 21 see [#RelatedTickets] below) … … 27 27 As this will be a major redesign of the data model, 28 28 it could also be a good opportunity to take the 29 **MultipleProjectSupport** considerations into account (#1 30).29 **MultipleProjectSupport** considerations into account (#11025). 30 30 31 31 Somehow related to the generic data model, but not strictly depending on it, … … 136 136 The new model is heavily relational, as opposed to the earlier EAV-like approach (see [./Brainstorm#EAV]). 137 137 138 We keep a maintable for the resource, for all 1-to-1 properties and relations (table named `Ticket` here).138 We keep a ''primary'' table for the resource, for all 1-to-1 properties and relations (table named `Ticket` here). 139 139 140 140 We now make systematic use of surrogate keys, to allow for efficient relations between resources. That key will however remain hidden, an implementation detail. The visible ID for a ticket either stays the same as before or can even become more flexible (#9624, sub-tickets with dotted notation). 141 141 142 All the properties that may contain multiple values are located in a secondary table(`<Resource>_<[Ff]ield>`) with three columns: `<resource>`, `<field>` and `<seq>` for keeping the multiple values ordered. Note that `<[Ff]ield>` might be either a //property// (`<field>`), the secondary table `<field>` column then contains directly a value, or a //relation// (`<Field>`), in which case the secondary table `<field>` column contains the surrogate key of the related resource.142 All the properties that may contain multiple values are located in ''secondary'' tables (`<Resource>_<[Ff]ield>`) with three columns: `<resource>`, `<field>` and `<seq>` for keeping the multiple values ordered. Note that `<[Ff]ield>` might be either a //property// (`<field>`), the secondary table `<field>` column then contains directly a value, or a //relation// (`<Field>`), in which case the secondary table `<field>` column contains the surrogate key of the related resource. 143 143 144 144 There's only one multi-valued property left, for the keywords, and all the others 1-m fields become relations: … … 309 309 }}} 310 310 311 At first sight, this seems far more complex than the old model , but in fact it's above all more explicit, with no "hidden" structure (except for the `oldval`/`newval`). And the regularities in the model means we're going to be able to provide a convenient high-level API for dealing with it.311 At first sight, this seems far more complex than the old model was, but in fact it's above all more explicit, with no "hidden" structure (except for the `oldval`/`newval`). And the regularities in the model means we're going to be able to provide a convenient high-level API for dealing with it. 312 312 313 313 In addition, even though the relational information given by the foreign keys can be enlightening for understanding the data model, we'll need an additional descriptive layer, metadata describing the precise relationships between the tables (e.g. list of fields for a given resource/type?). 314 315 This metadata is a natural continuation of the configuration of fields one can find in `[ticket-custom]` section of TracIni. Of course this time it is generalized to the "standard" resources and fields, and it is stored in the DB. Speaking of custom fields, one can see how custom fields fit in the above approach: they will simply correspond to additional secondary tables. The presence of a field in the primary table or in one secondary table becomes an implementation detail abstracted away by the metadata description of the resource. This will be also used to ease the transition to the new model by first describing the "current" state (all 1-to-1 fields in the primary table) and allowing for progressive upgrade steps. 316 317 Finally, for the code that would handle the resources in a generic way, instead of dealing with the same tables for every resources (the EAV approach), they would deal with the same API and use the metadata to know how to handle each particular kind of resources. 318 319 By the way, we could also easily graft the idea of ''sub-types'' (cf. TicketTypes) that would use the same primary table as their main type but perhaps a subset (or a slightly different set) of secondary tables (e.g. no 'Version' for tasks). 314 320 315 321 … … 329 335 custom fields, queries, etc.) to other resources (milestone, wiki, component, ...) 330 336 337 === Applied on new Component and Version resources === 338 339 The not yet existing resource types like 'component' and 'version' will be implemented using this generic approach (#1233). Initially the corresponding fields would remain in the primary Ticket table, they will be replaced from being properties (`component`, `version`) to relations (`Component`, `Version`). In a second step we could move these fields from the primary Ticket table to new secondary relation tables (`Ticket_Version`) and (`Ticket_Component`), still keeping the 1-to-1 relationship. The last step would be to allow them to be used as multi-valued relations (1 ticket to m versions and components). 331 340 332 341 === Applied on Milestone module === … … 352 361 See how a VCS backend could be written for the versioned generic scheme... 353 362 354 === Applied on Component module ===355 356 An other possibility would be to start on fresh ground, implementing not yet existing resource typse in a generic way (#1233). That would be the less disrupting approach, as everything else should just continue to work unchanged (or mostly unchanged, except for things like #5211 and places where we deal with the old `component` table).357 358 363 359 364 == Related Tickets ==