176 | | '''resource_revprop''' |
177 | | || ''changeid'' || ''revprop'' || ''value'' || |
| 175 | For 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 | |
| 184 | The 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?) |
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 | |
| 201 | A given revision instance (here 101001) is usually related to a specific change in one resource, |
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. |
| 209 | We 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.). |
| 210 | Deletions of fields could be represented by setting a field to the NULL value. |
| 211 | |
| 212 | |
| 213 | 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 //(not sure if this still applies, though)//. |