Edgewall Software

Changes between Version 17 and Version 18 of GenericTrac


Ignore:
Timestamp:
Apr 13, 2010, 3:35:29 PM (14 years ago)
Author:
Christian Boos
Comment:

rename name columns to clarify the meaning

Legend:

Unmodified
Added
Removed
Modified
  • GenericTrac

    v17 v18  
    4747(as columns in the `ticket` table)
    4848and a flexible set of properties
    49 (as name/value columns in a `ticket_custom` table).
     49(as prop/value columns in a `ticket_custom` table).
    5050
    5151Both styles have advantages and disadvantages:
     
    5555   - (+) faster (?)
    5656   - (+) straightforward code (`for field1,field2, ... in cursor: ...`) (?)
    57  2. properties in name/value columns
     57 2. properties in prop/value columns
    5858   - (+) highest flexibility, add or remove fields at will
    59    - (+) allow for multiple values per name, provided we don't use a primary key
     59   - (+) allow for multiple values per property, provided we don't use a primary key
    6060     as we currently do for the `ticket_custom` table (#918)
    6161     - (+) a slight extension would allow ordered multiple values (sequences), otherwise we have no control over the order in which those multiple values are retrieved, which might introduce confusion as this order will vary when new values are added;
     
    7777
    7878'''ticket'''
    79 ||= id ||= name ||= value ||= seq ||
    80 
    81 //seq// is the sequence number in case of multiple entries with the same name.
     79||= id ||= prop ||= value ||= seq ||
     80
     81//seq// is the sequence number in case of multiple entries with the same property name.
    8282
    8383or even:
    8484
    8585'''resource_prop'''
    86 ||= realm ||= id ||= name ||= value ||= seq ||
     86||= realm ||= id ||= prop ||= value ||= seq ||
    8787(if we use one mega table for all resources)
    8888
    8989
    9090
    91 Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,name/value)` form.
     91Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,prop/value)` form.
    9292
    9393We could also keep the metadata associated to the properties in the database,
     
    9696
    9797'''resource_schema'''
    98 || ''realm'' || ''prop'' || ''name'' || ''value'' ||
    99 
    100 Here, possible values for ''name'' could be 'label', 'default', 'order', 'type', etc.
    101 
    102 Example.
     98||= realm ||= prop ||= metaprop ||= value ||
     99
     100Here, possible content for ''prop'' could be 'label', 'default', 'order', 'type', etc.
     101
     102Example:
    103103|| ticket || description || type || wiki ||
    104104|| ticket || priority || type || enum ||
     
    137137     the unique ''resource_prop'' table approach is possible
    138138   - more compact, not that difficult to read either (there would always be a
    139      ''name=id'', ''value=the natural key'' entry
     139     ''prop=id'', ''value=the natural key'' entry
    140140   - renaming is easy (relations preserved)
    141141
     
    144144
    145145Now if this is the case, the '''resource_prop''' table could as well become:
    146 ||= id ||= name ||= value ||= //seq//
    147 and the ''realm'' information could simply be stored as another name/value entry.
     146||= id ||= prop ||= value ||= //seq//
     147and the ''realm'' information could simply be stored as another prop/value entry.
    148148
    149149
     
    152152We need to differentiate between the changes to the data, and the metadata about the change. The metadata is about who did the change, when, why the change was made, etc.
    153153We can adopt the same flexible strategy as the one for resource properties and
    154 store arbitrary name/value pairs of "revision properties".
     154store arbitrary key/value pairs of "revision properties".
    155155
    156156'''resource_revprop'''
    157 || ''changeid'' || ''name'' || ''value'' ||
     157|| ''changeid'' || ''revprop'' || ''value'' ||
    158158
    159159Typical example:
     
    177177
    178178'''ticket_change'''
    179 ||= id ||= changeid ||= name ||= value ||= seq ||
     179||= id ||= changeid ||= prop ||= value ||= seq ||
    180180
    181181'''milestone_change'''
    182 ||= id ||= changeid ||= name ||= value ||= seq ||
     182||= id ||= changeid ||= prop ||= value ||= seq ||
    183183
    184184or:
    185185
    186186'''resource_change'''
    187 ||= id ||= changeid ||= name ||= value ||= seq ||
     187||= id ||= changeid ||= prop ||= value ||= seq ||
    188188(surrogate key approach)
    189189
     
    218218
    219219'''resource_schema'''
    220 ||= realm ||= prop ||= name ||= value ||
     220||= realm ||= prop ||= metaprop ||= value ||
    221221|| string || string || string || text ||
    222222
    223223'''resource_prop'''
    224 ||= id ||= name ||= value ||= seq ||
     224||= id ||= prop ||= value ||= seq ||
    225225|| int || string || text || int ||
    226226
    227227'''resource_revprop'''
    228 ||= changeid ||= name ||= value ||= seq ||
     228||= changeid ||= revprop ||= value ||= seq ||
    229229|| int || string || text || int ||
    230230
    231231'''resource_change'''
    232 ||= id ||= changeid ||= name ||= value ||= seq ||
     232||= id ||= changeid ||= prop ||= value ||= seq ||
    233233|| int || int || string || text || int ||
    234234}}}
     
    239239
    240240'''resource_schema'''
    241 ||= realm ||= prop ||= name ||= value ||
     241||= realm ||= prop ||= metaprop ||= value ||
    242242|| ticket    || summary     || type     || text ||
    243243|| ticket    || description || type     || wiki ||
     
    245245
    246246'''resource_prop'''
    247 ||= id ||= name ||= value ||= seq ||
     247||= id ||= prop ||= value ||= seq ||
    248248|| 0||   id      ||   130     || 0||
    249249|| 0|| summary   ||Multiple Project Support|| 0||
     
    252252
    253253'''resource_revprop'''
    254 ||= changeid ||= name ||= value ||= seq ||
     254||= changeid ||= revprop ||= value ||= seq ||
    255255|| 1|| author  ||    joe    || 0||
    256256|| 1|| date    ||5 years ago|| 0||
     
    263263
    264264'''resource_change'''
    265 ||= id ||= changeid ||= name ||= value ||= seq ||
    266 ||      0||          1||    id     ||130|| 0||
    267 || 0|| 1||  summary  ||Multiple Project Support|| 0||
     265||= id ||= changeid ||= prop ||= value ||= seq ||
     266|| 0|| 1|| id        ||130|| 0||
     267|| 0|| 1|| summary   ||Multiple Project Support|| 0||
    268268|| 0|| 1||description||Should be easy...|| 0||
    269 || 0|| 1||  reporter ||joe|| 0||
     269|| 0|| 1|| reporter ||joe|| 0||
    270270|| 0|| 2||description||Should be easy... Redmine has it! || 0||
    271271|| 0|| 3||description||One day...|| 0||
     
    297297
    298298==== Schema ====
    299 **FIXME** need to add the `seq` columns here as well
    300299
    301300'''resource_schema'''
    302 || ''realm'' || ''prop'' || ''name'' || ''value'' ||
    303 ||   string  ||  string  ||  string  ||    text  ||
     301||= realm ||= prop ||= metaprop ||= value ||
     302|| string || string || string || text ||
    304303
    305304
    306305'''resource_prop'''
    307 || ''id'' || ''name'' || ''value'' ||
    308 ||  int   ||   string ||    text  ||
     306||= id ||= prop ||= value ||= seq ||
     307|| int || string || text || int ||
    309308
    310309'''resource_revprop'''
    311 || ''changeid'' || ''name'' || ''value'' ||
    312 ||      int     ||   string ||    text  ||
     310||= changeid ||= revprop ||= value ||= seq ||
     311|| int || string || text || int ||
    313312
    314313'''resource_change'''
    315 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
    316 ||   int  ||      int     ||   string ||    text  ||
     314||= id ||= changeid ||= prop ||= value ||= seq ||
     315|| int || int || string || text || int ||
    317316
    318317
    319318'''resource_prop_string'''
    320 || ''id'' || ''name'' || ''value'' ||
    321 ||  int   ||   string ||   string ||
     319||= id ||= prop ||= value ||= seq ||
     320|| int || string || string || int ||
    322321
    323322'''resource_revprop_string'''
    324 || ''changeid'' || ''name'' || ''value'' ||
    325 ||      int     ||   string ||   string ||
     323||= changeid ||= revprop ||= value ||= seq ||
     324|| int || string || string || int ||
    326325
    327326'''resource_change_string'''
    328 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
    329 ||   int  ||      int     ||   string ||   string ||
     327||= id ||= changeid ||= prop ||= value ||= seq ||
     328|| int || int || string || string || int ||
    330329
    331330
    332331'''resource_prop_int'''
    333 || ''id'' || ''name'' || ''value'' ||
    334 ||  int   ||   string ||   int    ||
     332||= id ||= prop ||= value ||= seq ||
     333|| int || string || int || int ||
    335334
    336335'''resource_revprop_int'''
    337 || ''changeid'' || ''name'' || ''value'' ||
    338 ||      int     ||   string ||   int    ||
     336||= changeid ||= revprop ||= value ||= seq ||
     337|| int || string || int || int ||
    339338
    340339'''resource_change_int'''
    341 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
    342 ||   int  ||      int     ||   string ||   int    ||
     340||= id ||= changeid ||= prop ||= value ||= seq ||
     341|| int || int || string || int || int ||
    343342
    344343}}}
     
    351350
    352351'''resource_schema'''
    353 || ''realm'' || ''prop''    || ''name'' || ''value'' ||
    354 || ticket    || summary     || type    || text ||
    355 || ticket    || description || type     || wiki||
    356 || ticket    || reporter    || type     || string||
     352||= realm ||= prop ||= metaprop ||= value ||
     353|| ticket || summary || type || text ||
     354|| ticket || description || type || wiki ||
     355|| ticket || reporter || type || string ||
    357356
    358357----
    359358
    360359'''resource_prop'''
    361 || ''id'' || ''name''  || ''value'' ||
    362 ||      0 || summary   ||Multiple Project Support||
    363 ||      0 ||description||One day... ||
     360||= id ||= prop ||= value ||= seq ||
     361|| 0|| summary   ||Multiple Project Support|| 0||
     362|| 0||description||One day... || 0||
    364363
    365364'''resource_revprop'''
    366 || ''changeid'' || ''name'' || ''value'' ||
    367 ||          2   || comment  || come on...||
    368 ||          3   || comment  || sure...   ||
     365||= changeid ||= revprop ||= value ||= seq ||
     366|| 2|| comment  || come on...|| 0||
     367|| 3|| comment  || sure...   || 0||
    369368
    370369'''resource_change'''
    371 || ''id'' || ''changeid'' || ''name''  || ''value'' ||
    372 ||      0 ||          1   ||  summary  ||Multiple Project Support||
    373 ||      0 ||          1   ||description||Should be easy...||
    374 ||      0 ||          2   ||description||Should be easy... Redmine has it!||
    375 ||      0 ||          3   ||description||One day...||
     370||= changeid ||= revprop ||= value ||= seq ||
     371|| 0 || 1||  summary  ||Multiple Project Support|| 0||
     372|| 0 || 1||description||Should be easy...|| 0||
     373|| 0 || 2||description||Should be easy... Redmine has it!|| 0||
     374|| 0 || 3||description||One day...|| 0||
    376375
    377376----
    378377
    379378'''resource_prop_string'''
    380 || ''id'' || ''name''  || ''value'' ||
    381 ||      0 || reporter  ||   joe     ||
     379||= id ||= prop ||= value ||= seq ||
     380|| 0|| reporter || joe || 0||
    382381
    383382'''resource_revprop_string'''
    384 || ''changeid'' || ''name'' || ''value'' ||
    385 ||          1   ||  author  ||    joe    ||
    386 ||          2   ||  author  ||    joe    ||
    387 ||          3   ||  author  ||   cboos   ||
     383||= changeid ||= revprop ||= value ||= seq ||
     384|| 1|| author || joe    || 0||
     385|| 2|| author || joe    || 0||
     386|| 3|| author || cboos  || 0||
    388387
    389388'''resource_change_string'''
    390 || ''id'' || ''changeid'' || ''name''  || ''value'' ||
    391 ||      0 ||          1   ||  reporter ||joe||
     389||= id ||= changeid ||= prop ||= value ||= seq ||
     390|| 0|| 1|| reporter ||joe|| 0||
    392391
    393392----
    394393
    395394'''resource_prop_int'''
    396 || ''id'' || ''name''  || ''value'' ||
    397 ||      0 ||   id      ||   130    ||
     395||= id ||= prop ||= value ||= seq ||
     396|| 0 || id || 130 || 0 ||
    398397
    399398'''resource_revprop_int'''
    400 || ''changeid'' || ''name'' || ''value'' ||
    401 ||          1   ||   date   ||5 years ago||
    402 ||          2   ||   date   ||2 years ago||
    403 ||          3   ||   date   ||1 year ago ||
     399||= changeid ||= revprop ||= value ||= seq ||
     400|| 1||   date   ||5 years ago|| 0||
     401|| 2||   date   ||2 years ago|| 0||
     402|| 3||   date   ||1 year ago || 0||
    404403
    405404'''resource_change_int'''
    406 || ''id'' || ''changeid'' || ''name''  || ''value'' ||
    407 ||      0 ||          1   ||    id     ||130||
     405||= id ||= changeid ||= prop ||= value ||= seq ||
     406|| 0|| 1|| id ||130||0||
    408407
    409408}}}
     
    450449}}}
    451450 - And please rename the ''name'' field to ''prop'' so that it matches the one in the resource_schema table.
    452    - (cboos) will do
     451   - (cboos) done - now I use `prop` consistently to talk about resource property keys, `revprop` to talk about change property keys and `metaprop` in the schema (as those are properties of properties)
    453452 - Also I would like to have the resource_schema table extended so that it will support different schemas for, say, different ticket types. That way, users can define their personal ticket type schemas. Of course, derivation would also be nice, but that could be implemented at a later point in time, requiring yet another table. That way we could have both inheritance at the schema level and also multiple different models per realm ;)
    454453  {{{