Edgewall Software

Changes between Version 31 and Version 32 of GenericTrac


Ignore:
Timestamp:
Aug 3, 2010, 6:38:10 PM (14 years ago)
Author:
Christian Boos
Comment:

reusing the #generic-scheme for the #History

Legend:

Unmodified
Added
Removed
Modified
  • GenericTrac

    v31 v32  
    9595So for example the new model could be simply:
    9696
    97  ||||||||=     '''ticket'''       =||
     97 ||||||||=     '''ticket_prop''    ||
    9898 ||= id ||= prop ||= value ||= seq ||
    9999
     
    113113Furthermore, properties not defined in the schema could simply be ignored, so this would allow a great deal of flexibility for plugins when they need to store "special" properties or revision properties.
    114114
    115 ==== The Generic Scheme
     115==== The Generic Scheme #generic-scheme
    116116Actually, for achieving requirement 3. & 4., we need specialized tables,
    117117one for each different value column type we want to support:
     
    167167 - ''**duplicate-of**/duplicated-by'': a ticket may be qualified to be a ''duplicate-of'' of another ticket ; that other ticket is ''duplicated-by'' one or many tickets, but this is less strong
    168168
    169 
    170 === Resource History ===
     169==== History
    171170
    172171We 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.
     
    174173store arbitrary key/value pairs of "revision properties".
    175174
    176 '''resource_revprop'''
    177 || ''changeid'' || ''revprop'' || ''value'' ||
     175For implementing a simple db backed VCS, we can even adopt the same [#generic-scheme generic scheme] as described above, but for two derived resource:
     176 - one for snapshotting the resource properties at a given point in time "{resource}_version", e.g. `ticket_version`
     177 - one representing the metadata corresponding to the change, describing the act of creating a new version, i.e. revisioning:  "{resource}_rev", e.g. a `ticket_rev` (or `ticket_revision`?)
     178
     179||||||||=  '''ticket_version_prop'''  ||
     180||= id ||= prop ||= value ||= seq ||
     181||||||||=  '''ticket_rev_prop'''  ||
     182||= id ||= prop ||= value ||= seq ||
     183
     184The main resource and the derived resources would be related together:
     185 - the main resource would point to the lastchange (shortcut, this could be deduced by inspecting the ''date'' stored in the _rev_prop table - so in a "normalized" schema we wouldn't need it)
     186 - a revision resource would point to the corresponding version which was created at the same time (again, matching with the ''date'' would be possible?)
    178187
    179188Typical example:
    180 || 101001 || author  || cboos         ||
    181 || 101001 || auth    || 1             ||
    182 || 101001 || date    || 1231232114.12 ||
    183 || 101001 || comment || random change ||
    184 
    185 A given ''changeid'' is usually related to a specific change in one resource,
     189||||||||=  '''ticket_prop'''  ||
     190|| 1001 || id || 1 || 2021010101 ||
     191|| 1001 || lastchange || 101001 ||
     192||||||||=  '''ticket_rev_prop'''  ||
     193|| 101001 || ticket  || 1001         ||  23232323333 ||
     194|| 101001 || auth    || 1            ||  23232323334 ||
     195|| 101001 || date    || 123123211422 ||  23232323335 ||
     196|| 101001 || version || 202002       ||  23232323336 ||
     197||||||||=  '''ticket_rev_prop_int''  ||
     198|| 202002 || author  || cboos        ||  23232323337 ||
     199|| 202002 || comment || random change ||  23232323338 ||
     200
     201A given revision instance (here 101001) is usually related to a specific change in one resource,
    186202but there could be other situations:
    187203 - one change affecting lots of resources (typically #4582 and #5658, ticket batch changes #525)
    188204 - changes affecting changes (typically #454); now that we have completed #454, it would be interesting to see what constraints this impose on the new model
    189205
     206Here we see that one change can easily cover multiple tickets, useful for storing metadata related to batch changes, via different sequence numbers for the ''ticket'' property, and a corresponding sequence of ''version'' property.
    190207
    191208The property changes themselves are stored in other tables.
    192 We only need the changed properties here, no need to store the old/new values
    193 for each change, as this can be deduced from the past changes.
    194 Deletions of fields should be represented by setting a field to the NULL value.
    195 
    196 Several possibilities here:
    197 
    198 '''ticket_change'''
    199 ||= id ||= changeid ||= prop ||= value ||= seq ||
    200 
    201 '''milestone_change'''
    202 ||= id ||= changeid ||= prop ||= value ||= seq ||
    203 
    204 or:
    205 
    206 '''resource_change'''
    207 ||= id ||= changeid ||= prop ||= value ||= seq ||
    208 (surrogate key approach)
    209 
    210 The latter has the advantage that it would make easy to relate a given ``changeid``
    211 to the resource(s) that were affected by the change, without having to go through
    212 each resource table.
    213 
    214 We could also keep all property changes as text values
    215 or have extra `..._int` (`..._float`) tables for more compact
    216 representation.
    217 
    218 See also ticket:6466#comment:10 and follow-ups for a discussion about how ticket changes and in particular ticket change edits, could be handled using this approach.
     209We only need the properties that have changed here, no need to store the old/new values for each change, as this can be deduced from the past changes. No need to store the properties which haven't changed either (requirement 4.).
     210Deletions of fields could be represented by setting a field to the NULL value.
     211
     212
     213See also ticket:6466#comment:10 and follow-ups for a discussion about how ticket changes and in particular ticket change edits, could be handled using this approach //(not sure if this still applies, though)//.
    219214
    220215