Changes between Version 29 and Version 30 of GenericTrac
- Timestamp:
- Aug 3, 2010, 10:59:01 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenericTrac
v29 v30 94 94 So for example the new model could be simply: 95 95 96 '''ticket''' 97 ||= id ||= prop ||= value ||= seq ||96 ||||||||= '''ticket''' =|| 97 ||= id ||= prop ||= value ||= seq || 98 98 99 99 //seq// is the sequence number in case of multiple entries with the same property name. 100 100 101 or even: 102 103 '''resource_prop''' 104 ||= realm ||= id ||= prop ||= value ||= seq || 105 (if we use one mega table for all resources) 106 107 108 109 Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,prop/value)` form. 101 Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,prop,value)` form, we'd only have to add `seq`. 102 110 103 111 104 We could also keep the metadata associated to the properties in the database, … … 113 106 unification of the representation for fixed fields and custom fields. 114 107 115 '''resource_schema'''116 ||= realm ||= prop ||= metaprop ||= value ||117 118 Here, possible content for ''prop'' could be 'label', 'default', 'order', 'type', etc.119 120 Example:121 || ticket || description || type || wiki ||122 || ticket || priority || type || enum ||123 || ticket || priority || enum || priority ||124 || ticket || priority || default || normal ||125 || ticket || need_review || type || checkbox ||126 || ticket || need_review || default || 0 ||127 108 128 109 Note: the existence of a schema describing the fields doesn't mean that modules … … 131 112 Furthermore, 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. 132 113 133 As a possible refining, it could be possible to have specialized tables, 114 115 Actually, for achieving requirement 3. & 4., we need specialized tables, 134 116 one for each different value column type we want to support: 135 - ''' resource_prop''' for text values136 - ''' resource_prop_int''' for integer values137 - (''' resource_prop_float''' for float values, if really needed)117 - '''{resource}_prop''' for text values 118 - '''{resource}_prop_int''' for integer values, identifiers and dates (using "bigint") 119 - ('''{resource}_prop_float''' for float values, if really needed) 138 120 And we could even differentiate between short and long text values (requirement 4): 139 - ''' resource_prop''' for short text values140 - ''' resource_prop_text''' for long text values121 - '''{resource}_prop''' for short text values 122 - '''{resource}_prop_text''' for long text values 141 123 (see #6986). 142 124 125 This set of tables is a "generic scheme" that can be easily created for any kind of "resource". There's also a trade-off here, between using one very generic set of "resource_..." table versus special instances like "ticket_...": having one set of tables presents the risk of introducing too much contention for backends using table locking, and leads to writing queries that will contain lots of difficult to joins. We will already have enough issues with this when writing multicriteria search queries... 143 126 144 127 Along the same lines there's also the question of what should be the ''id'': … … 157 140 - renaming is easy (relations are preserved) 158 141 159 160 This all suggests that using surrogate keys would be preferable, with a single '''resource_prop''' table. 142 This all suggests that using surrogate keys would be preferable. 161 143 162 144 If this is the case, the '''resource_prop''' table could as well become simply: … … 224 206 225 207 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. 208 226 209 227 210