Skip to content

Commit 9b58a4b

Browse files
committed
Remove @DeleteRelationships support in @UpdateTopic
Previously, in order to update existing relationships, callers had to trigger `UpdateTopic`'s `@DeleteRelationships` flag—which would delete all relationships for that topic—and _then_ call `UpdateRelationships` with the final relationships set. This was wasteful, as often times the relationships will have overlap, or even be identical. This issue was fixed with with the introduction of the `@DeleteUnmatched` parameter to the `UpdateRelationships` stored procedure in the last commit (46ba436). Given that, we can now remove the `@DeleteRelationships` functionality from `UpdateTopic`. That said, since `@DeleteRelationships` is part of the public interface, we don't want to remove it as that would require that the `SqlTopicRepository` version be aligned with the database version—something we restrict to major releases, as part of semantic versioning. As such, we're keeping the `@DeleteRelationships` parameter, but removing the functionality. If the database is up-to-date with this release, that will yield the same results as before. If the database isn't, it will still accept the `@DeleteRelationships` parameter, as expected, and behave as it used to. (Since the only reasonable purpose of calling `@DeleteRelationships` was to subsequently call `UpdateRelationships`, there's no expected off-target impact to this.)
1 parent 46ba436 commit 9b58a4b

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,6 @@ CROSS APPLY (
9999
WHERE IsNull(AttributeValue, '') = ''
100100
AND ExistingValue != ''
101101

102-
--------------------------------------------------------------------------------------------------------------------------------
103-
-- REMOVE EXISTING RELATIONS
104-
--------------------------------------------------------------------------------------------------------------------------------
105-
-- Relationships will be re-added by the Data Access Layer using Topics_PersistRelationships.
106-
--------------------------------------------------------------------------------------------------------------------------------
107-
DELETE
108-
FROM [dbo].[Relationships]
109-
WHERE Source_TopicID = @TopicID
110-
AND @DeleteRelationships = 1
111-
112102
--------------------------------------------------------------------------------------------------------------------------------
113103
-- RETURN TOPIC ID
114104
--------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)