Edgewall Software

Changes between Version 15 and Version 16 of GenericTrac


Ignore:
Timestamp:
Apr 13, 2010, 2:40:41 PM (14 years ago)
Author:
Christian Boos
Comment:

introduce the idea of sequences

Legend:

Unmodified
Added
Removed
Modified
  • GenericTrac

    v15 v16  
    5353   - (-) only flexibility is to not use some fields (e.g. severity)
    5454   - (-) no multiple values per field possible 
    55    - (+) faster
    56    - (+) straightforward code (`for field1,field2, ... in cursor: ...`)
     55   - (+) faster (?)
     56   - (+) straightforward code (`for field1,field2, ... in cursor: ...`) (?)
    5757 2. properties in name/value columns
    5858   - (+) highest flexibility, add or remove fields at will
    5959   - (+) allow for multiple values per name, provided we don't use a primary key
    6060     as we currently do for the `ticket_custom` table (#918)
     61     - (+) 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;
     62       while primarily useful for `int` fields, this could also be useful to implement `text` fields for Oracle (working around the limits on varchars and not having to use CLOBs)
    6163   - (-) slower, less memory efficient (?)
    6264   - (-) more complex code (?)
     65(?) means ''yet to be verified''
    6366
    6467In order to reduce the overall complexity, the idea would be to pick only one approach, instead of having to support both.
     
    7477
    7578'''ticket'''
    76 || ''id'' || ''name'' || ''value'' ||
     79||= id ||= name ||= value ||= seq ||
     80
     81//seq// is the sequence number in case of multiple entries with the same name.
    7782
    7883or even:
    7984
    8085'''resource_prop'''
    81 || ''realm'' || ''id'' || ''name'' || ''value'' ||
     86||= realm ||= id ||= name ||= value ||= seq ||
    8287(if we use one mega table for all resources)
     88
     89
    8390
    8491Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,name/value)` form.
     
    134141
    135142This suggests that using surrogate keys would be preferable.
     143
     144
    136145Now if this is the case, the '''resource_prop''' table could as well become:
    137 || ''id'' || ''name'' || ''value'' ||
    138 and the ''realm'' information could simply be store as another name/value entry.
     146||= id ||= name ||= value ||= //seq//
     147and the ''realm'' information could simply be stored as another name/value entry.
    139148
    140149
     
    168177
    169178'''ticket_change'''
    170 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
     179||= id ||= changeid ||= name ||= value ||= seq ||
    171180
    172181'''milestone_change'''
    173 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
     182||= id ||= changeid ||= name ||= value ||= seq ||
    174183
    175184or:
    176185
    177186'''resource_change'''
    178 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
     187||= id ||= changeid ||= name ||= value ||= seq ||
    179188(surrogate key approach)
    180189
     
    209218
    210219'''resource_schema'''
    211 || ''realm'' || ''prop'' || ''name'' || ''value'' ||
    212 ||   string  ||  string  ||  string  ||    text  ||
     220||= realm ||= prop ||= name ||= value ||
     221|| string || string || string || text ||
    213222
    214223'''resource_prop'''
    215 || ''id'' || ''name'' || ''value'' ||
    216 ||  int   ||   string ||   text    ||
     224||= id ||= name ||= value ||= seq ||
     225|| int || string || text || int ||
    217226
    218227'''resource_revprop'''
    219 || ''changeid'' || ''name'' || ''value'' ||
    220 ||      int     ||   string ||   text    ||
     228||= changeid ||= name ||= value ||= seq ||
     229|| int || string || text || int ||
    221230
    222231'''resource_change'''
    223 || ''id'' || ''changeid'' || ''name'' || ''value'' ||
    224 ||   int  ||      int     ||   string ||   text    ||
     232||= id ||= changeid ||= name ||= value ||= seq ||
     233|| int || int || string || text || int ||
    225234}}}
    226235{{{
     
    230239
    231240'''resource_schema'''
    232 || ''realm'' || ''prop''    || ''name'' || ''value'' ||
     241||= realm ||= prop ||= name ||= value ||
    233242|| ticket    || summary     || type     || text ||
    234 || ticket    || description || type     || wiki||
     243|| ticket    || description || type     || wiki ||
    235244|| ticket    || reporter    || type     || text ||
    236245
    237246'''resource_prop'''
    238 || ''id'' || ''name''  || ''value'' ||
    239 ||      0 ||   id      ||   130     ||
    240 ||      0 || summary   ||Multiple Project Support||
    241 ||      0 ||description||One day... ||
    242 ||      0 || reporter  ||   joe     ||
     247||= id ||= name ||= value ||= seq ||
     248|| 0||   id      ||   130     || 0||
     249|| 0|| summary   ||Multiple Project Support|| 0||
     250|| 0||description||One day... || 0||
     251|| 0|| reporter  ||   joe     || 0||
    243252
    244253'''resource_revprop'''
    245 || ''changeid'' || ''name'' || ''value'' ||
    246 ||          1   ||  author  ||    joe    ||
    247 ||          1   ||   date   ||5 years ago||
    248 ||          2   ||  author  ||    joe    ||
    249 ||          2   ||   date   ||2 years ago||
    250 ||          2   || comment  || come on...||
    251 ||          3   ||  author  ||   cboos   ||
    252 ||          3   ||   date   ||1 year ago ||
    253 ||          3   || comment  || sure...   ||
     254||= changeid ||= name ||= value ||= seq ||
     255|| 1|| author  ||    joe    || 0||
     256|| 1|| date    ||5 years ago|| 0||
     257|| 2|| author  ||    joe    || 0||
     258|| 2|| date    ||2 years ago|| 0||
     259|| 2|| comment || come on...|| 0||
     260|| 3|| author  ||   cboos   || 0||
     261|| 3|| date    ||1 year ago || 0||
     262|| 3|| comment || sure...   || 0||
    254263
    255264'''resource_change'''
    256 || ''id'' || ''changeid'' || ''name''  || ''value'' ||
    257 ||      0 ||          1   ||    id     ||130||
    258 ||      0 ||          1   ||  summary  ||Multiple Project Support||
    259 ||      0 ||          1   ||description||Should be easy...||
    260 ||      0 ||          1   ||  reporter ||joe||
    261 ||      0 ||          2   ||description||Should be easy... Redmine has it!||
    262 ||      0 ||          3   ||description||One day...||
     265||= id ||= changeid ||= name ||= value ||= seq ||
     266||      0||          1||    id     ||130|| 0||
     267|| 0|| 1||  summary  ||Multiple Project Support|| 0||
     268|| 0|| 1||description||Should be easy...|| 0||
     269|| 0|| 1||  reporter ||joe|| 0||
     270|| 0|| 2||description||Should be easy... Redmine has it! || 0||
     271|| 0|| 3||description||One day...|| 0||
    263272}}}
    264273
     
    278287=== Complete Model ===
    279288 - surrogate keys for all resources
    280  - int, short and long text fields
     289 - int, bigint, short and long text fields
    281290
    282291Not absolutely necessary to go that far, this could nevertheless help a lot for the MySQL backend (#6986), possibly also for a future Oracle backend. Don't know about PostgreSQL, but for SQLite this should be indifferent.
     292
     293`bigint` is needed since we use this to store microsecond precision timestamps (#6466).
    283294
    284295{{{
     
    286297
    287298==== Schema ====
     299**FIXME** need to add the `seq` columns here as well
    288300
    289301'''resource_schema'''
     
    335347
    336348==== Example Dataset ====
     349
     350**FIXME** add example of multivalued property
    337351
    338352'''resource_schema'''