Changes between Version 17 and Version 18 of GenericTrac
- Timestamp:
- Apr 13, 2010, 3:35:29 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GenericTrac
v17 v18 47 47 (as columns in the `ticket` table) 48 48 and 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). 50 50 51 51 Both styles have advantages and disadvantages: … … 55 55 - (+) faster (?) 56 56 - (+) straightforward code (`for field1,field2, ... in cursor: ...`) (?) 57 2. properties in name/value columns57 2. properties in prop/value columns 58 58 - (+) highest flexibility, add or remove fields at will 59 - (+) allow for multiple values per name, provided we don't use a primary key59 - (+) allow for multiple values per property, provided we don't use a primary key 60 60 as we currently do for the `ticket_custom` table (#918) 61 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; … … 77 77 78 78 '''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. 82 82 83 83 or even: 84 84 85 85 '''resource_prop''' 86 ||= realm ||= id ||= name||= value ||= seq ||86 ||= realm ||= id ||= prop ||= value ||= seq || 87 87 (if we use one mega table for all resources) 88 88 89 89 90 90 91 Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id, name/value)` form.91 Note by the way that newer "resources", like `repository` in MultiRepos already have this `(id,prop/value)` form. 92 92 93 93 We could also keep the metadata associated to the properties in the database, … … 96 96 97 97 '''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 100 Here, possible content for ''prop'' could be 'label', 'default', 'order', 'type', etc. 101 102 Example: 103 103 || ticket || description || type || wiki || 104 104 || ticket || priority || type || enum || … … 137 137 the unique ''resource_prop'' table approach is possible 138 138 - more compact, not that difficult to read either (there would always be a 139 '' name=id'', ''value=the natural key'' entry139 ''prop=id'', ''value=the natural key'' entry 140 140 - renaming is easy (relations preserved) 141 141 … … 144 144 145 145 Now 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// 147 and the ''realm'' information could simply be stored as another prop/value entry. 148 148 149 149 … … 152 152 We 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. 153 153 We can adopt the same flexible strategy as the one for resource properties and 154 store arbitrary name/value pairs of "revision properties".154 store arbitrary key/value pairs of "revision properties". 155 155 156 156 '''resource_revprop''' 157 || ''changeid'' || '' name'' || ''value'' ||157 || ''changeid'' || ''revprop'' || ''value'' || 158 158 159 159 Typical example: … … 177 177 178 178 '''ticket_change''' 179 ||= id ||= changeid ||= name||= value ||= seq ||179 ||= id ||= changeid ||= prop ||= value ||= seq || 180 180 181 181 '''milestone_change''' 182 ||= id ||= changeid ||= name||= value ||= seq ||182 ||= id ||= changeid ||= prop ||= value ||= seq || 183 183 184 184 or: 185 185 186 186 '''resource_change''' 187 ||= id ||= changeid ||= name||= value ||= seq ||187 ||= id ||= changeid ||= prop ||= value ||= seq || 188 188 (surrogate key approach) 189 189 … … 218 218 219 219 '''resource_schema''' 220 ||= realm ||= prop ||= name||= value ||220 ||= realm ||= prop ||= metaprop ||= value || 221 221 || string || string || string || text || 222 222 223 223 '''resource_prop''' 224 ||= id ||= name||= value ||= seq ||224 ||= id ||= prop ||= value ||= seq || 225 225 || int || string || text || int || 226 226 227 227 '''resource_revprop''' 228 ||= changeid ||= name||= value ||= seq ||228 ||= changeid ||= revprop ||= value ||= seq || 229 229 || int || string || text || int || 230 230 231 231 '''resource_change''' 232 ||= id ||= changeid ||= name||= value ||= seq ||232 ||= id ||= changeid ||= prop ||= value ||= seq || 233 233 || int || int || string || text || int || 234 234 }}} … … 239 239 240 240 '''resource_schema''' 241 ||= realm ||= prop ||= name||= value ||241 ||= realm ||= prop ||= metaprop ||= value || 242 242 || ticket || summary || type || text || 243 243 || ticket || description || type || wiki || … … 245 245 246 246 '''resource_prop''' 247 ||= id ||= name||= value ||= seq ||247 ||= id ||= prop ||= value ||= seq || 248 248 || 0|| id || 130 || 0|| 249 249 || 0|| summary ||Multiple Project Support|| 0|| … … 252 252 253 253 '''resource_revprop''' 254 ||= changeid ||= name||= value ||= seq ||254 ||= changeid ||= revprop ||= value ||= seq || 255 255 || 1|| author || joe || 0|| 256 256 || 1|| date ||5 years ago|| 0|| … … 263 263 264 264 '''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|| 268 268 || 0|| 1||description||Should be easy...|| 0|| 269 || 0|| 1|| reporter||joe|| 0||269 || 0|| 1|| reporter ||joe|| 0|| 270 270 || 0|| 2||description||Should be easy... Redmine has it! || 0|| 271 271 || 0|| 3||description||One day...|| 0|| … … 297 297 298 298 ==== Schema ==== 299 **FIXME** need to add the `seq` columns here as well300 299 301 300 '''resource_schema''' 302 || ''realm'' || ''prop'' || ''name'' || ''value''||303 || string || string || string || text||301 ||= realm ||= prop ||= metaprop ||= value || 302 || string || string || string || text || 304 303 305 304 306 305 '''resource_prop''' 307 || ''id'' || ''name'' || ''value''||308 || int || string || text||306 ||= id ||= prop ||= value ||= seq || 307 || int || string || text || int || 309 308 310 309 '''resource_revprop''' 311 || ''changeid'' || ''name'' || ''value''||312 || int || string || text||310 ||= changeid ||= revprop ||= value ||= seq || 311 || int || string || text || int || 313 312 314 313 '''resource_change''' 315 || ''id'' || ''changeid'' || ''name'' || ''value''||316 || int || int || string || text||314 ||= id ||= changeid ||= prop ||= value ||= seq || 315 || int || int || string || text || int || 317 316 318 317 319 318 '''resource_prop_string''' 320 || ''id'' || ''name'' || ''value''||321 || int || string || string||319 ||= id ||= prop ||= value ||= seq || 320 || int || string || string || int || 322 321 323 322 '''resource_revprop_string''' 324 || ''changeid'' || ''name'' || ''value''||325 || int || string || string||323 ||= changeid ||= revprop ||= value ||= seq || 324 || int || string || string || int || 326 325 327 326 '''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 || 330 329 331 330 332 331 '''resource_prop_int''' 333 || ''id'' || ''name'' || ''value''||334 || int || string || int||332 ||= id ||= prop ||= value ||= seq || 333 || int || string || int || int || 335 334 336 335 '''resource_revprop_int''' 337 || ''changeid'' || ''name'' || ''value''||338 || int || string || int||336 ||= changeid ||= revprop ||= value ||= seq || 337 || int || string || int || int || 339 338 340 339 '''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 || 343 342 344 343 }}} … … 351 350 352 351 '''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 || 357 356 358 357 ---- 359 358 360 359 '''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|| 364 363 365 364 '''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|| 369 368 370 369 '''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|| 376 375 377 376 ---- 378 377 379 378 '''resource_prop_string''' 380 || ''id'' || ''name'' || ''value''||381 || 0 || reporter || joe||379 ||= id ||= prop ||= value ||= seq || 380 || 0|| reporter || joe || 0|| 382 381 383 382 '''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|| 388 387 389 388 '''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|| 392 391 393 392 ---- 394 393 395 394 '''resource_prop_int''' 396 || ''id'' || ''name'' || ''value''||397 || 0 || id || 130||395 ||= id ||= prop ||= value ||= seq || 396 || 0 || id || 130 || 0 || 398 397 399 398 '''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|| 404 403 405 404 '''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|| 408 407 409 408 }}} … … 450 449 }}} 451 450 - And please rename the ''name'' field to ''prop'' so that it matches the one in the resource_schema table. 452 - (cboos) will do451 - (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) 453 452 - 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 ;) 454 453 {{{