Skip to content

Commit 82c8e5e

Browse files
committed
Return Version for Attributes and ExtendedAttributes
Previously, `Version` was not returned for _any_ fields, only as a standalone value for the topic. In preparation for supporting import scenarios where having a last updated date is important, we are returning `Version` with `GetTopics`—and, thus, the `AttributeIndex` and `ExtendedAttributeIndex` views it depends upon. We will not be returning `Version` for key fields (i.e., `Key`, `ContentType`, and `ParentId`).
1 parent c7c9d33 commit 82c8e5e

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

OnTopic.Data.Sql.Database/Stored Procedures/GetTopics.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,18 @@ ORDER BY SortOrder
102102
--------------------------------------------------------------------------------------------------------------------------------
103103
SELECT Attributes.TopicID,
104104
Attributes.AttributeKey,
105-
Attributes.AttributeValue
105+
Attributes.AttributeValue,
106+
Attributes.Version
106107
FROM AttributeIndex Attributes
107108
JOIN #Topics AS Storage
108109
ON Storage.TopicID = Attributes.TopicID
109110

110111
--------------------------------------------------------------------------------------------------------------------------------
111-
-- SELECT AttributeXml
112+
-- SELECT EXTENDED ATTRIBUTES
112113
--------------------------------------------------------------------------------------------------------------------------------
113114
SELECT Attributes.TopicID,
114-
Attributes.AttributesXml
115+
Attributes.AttributesXml,
116+
Attributes.Version
115117
FROM ExtendedAttributeIndex AS Attributes
116118
JOIN #Topics AS Storage
117119
ON Storage.TopicID = Attributes.TopicID

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ WITH Attributes AS (
1313
SELECT TopicID,
1414
AttributeKey,
1515
AttributeValue,
16+
Version,
1617
RowNumber = ROW_NUMBER() OVER (
1718
PARTITION BY TopicID,
1819
AttributeKey
@@ -27,6 +28,7 @@ WITH Attributes AS (
2728
)
2829
SELECT Attributes.TopicID,
2930
Attributes.AttributeKey,
30-
Attributes.AttributeValue
31+
Attributes.AttributeValue,
32+
Attributes.Version
3133
FROM Attributes
3234
WHERE RowNumber = 1

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ AS
1212
WITH TopicExtendedAttributes AS (
1313
SELECT TopicID,
1414
AttributesXml,
15+
Version,
1516
RowNumber = ROW_NUMBER() OVER (
1617
PARTITION BY TopicID
1718
ORDER BY Version DESC
1819
)
1920
FROM [dbo].[ExtendedAttributes]
2021
)
2122
SELECT TopicID,
22-
AttributesXml
23+
AttributesXml,
24+
Version
2325
FROM TopicExtendedAttributes
2426
WHERE RowNumber = 1

0 commit comments

Comments
 (0)