Skip to content

Commit 752a826

Browse files
committed
Update stored procedure to account for associations
Previously, the `DeleteOrphanedLastModifiedAttributes` only accounted for `Attributes` and `ExtendedAttributes`, not `Relationships` and `TopicReferences`—and, as such, would not tripped if the only updates beyond `LastModified` or `LastModifiedBy` were in the association tables. This resolves that issue, as well as #88.
1 parent 96fb71d commit 752a826

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

OnTopic.Data.Sql.Database/Utilities/Stored Procedures/DeleteOrphanedLastModifiedAttributes.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,16 @@ LEFT JOIN Attributes Unmatched
4141
LEFT JOIN ExtendedAttributes UnmatchedExtended
4242
ON Attributes.TopicID = UnmatchedExtended.TopicID
4343
AND Attributes.Version = UnmatchedExtended.Version
44+
LEFT JOIN Relationships UnmatchedRelationships
45+
ON Attributes.TopicID = UnmatchedRelationships.Source_TopicID
46+
AND Attributes.Version = UnmatchedRelationships.Version
47+
LEFT JOIN TopicReferences UnmatchedReferences
48+
ON Attributes.TopicID = UnmatchedReferences.Source_TopicID
49+
AND Attributes.Version = UnmatchedReferences.Version
4450
WHERE Unmatched.AttributeKey IS NULL
4551
AND UnmatchedExtended.TopicID IS NULL
52+
AND UnmatchedRelationships.Source_TopicID IS NULL
53+
AND UnmatchedReferences.Source_TopicID IS NULL
4654
AND Attributes.AttributeKey LIKE 'LastModified%'
4755

4856
--------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)