Skip to content

Commit 9b710d2

Browse files
committed
Merge branch 'improvement/VersionHistoryIndex-all-sources' into develop
Previously, the `VersionHistoryIndex` only listed versions that were in the `Attributes` table. That should work fine so long as a `LastModified` and `LastModifiedBy` record is created, as is done by default in the OnTopic Editor. If those attributes are disabled, however, or the change is done programmatically, then updates that don't affect the `Attributes` table won't be reflected. To remedy this, the `VersionHistoryIndex` has been extended to additionally pull versions from `ExtendedAttributes`, `Relationships`, and `TopicReferences`. This resolves #78.
2 parents eb0615f + a1c15ba commit 9b710d2

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

OnTopic.Data.Sql.Database/Views/VersionHistoryIndex.sql

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,31 @@ AS (
1818
PARTITION BY TopicID
1919
ORDER BY Version DESC
2020
)
21-
FROM [dbo].[Attributes]
22-
GROUP BY TopicID,
21+
FROM (
22+
SELECT TopicID,
2323
Version
24+
FROM [dbo].[Attributes]
25+
GROUP BY TopicID,
26+
Version
27+
UNION
28+
SELECT TopicID,
29+
Version
30+
FROM [dbo].[ExtendedAttributes]
31+
GROUP BY TopicID,
32+
Version
33+
UNION
34+
SELECT Source_TopicID AS TopicID,
35+
Version
36+
FROM [dbo].[TopicReferences]
37+
GROUP BY Source_TopicID,
38+
Version
39+
UNION
40+
SELECT Source_TopicID AS TopicID,
41+
Version
42+
FROM [dbo].[Relationships]
43+
GROUP BY Source_TopicID,
44+
Version
45+
) AS VersionList
2446
)
2547
SELECT Versions.TopicId,
2648
Version

0 commit comments

Comments
 (0)