diff --git a/mssql/ddl/schema-constraints.sql b/mssql/ddl/schema-constraints.sql index 816167336..c67576194 100644 --- a/mssql/ddl/schema-constraints.sql +++ b/mssql/ddl/schema-constraints.sql @@ -4,6 +4,7 @@ ALTER TABLE Forum_hasMember_Person ADD PRIMARY KEY (ForumId, PersonId); ALTER TABLE Forum_hasTag_Tag ADD PRIMARY KEY (ForumId, TagId); ALTER TABLE Person_hasInterest_Tag ADD PRIMARY KEY (PersonId, TagId); ALTER TABLE Person_knows_Person ADD PRIMARY KEY (Person1Id, Person2Id); +ALTER TABLE Person_likes_Message ADD PRIMARY KEY (PersonId, MessageId); ALTER TABLE Person_studyAt_University ADD PRIMARY KEY (PersonId, UniversityId); ALTER TABLE Person_workAt_Company ADD PRIMARY KEY (PersonId, CompanyId); ALTER TABLE Message_hasTag_Tag ADD PRIMARY KEY (MessageId, TagId); diff --git a/mssql/ddl/triggers.sql b/mssql/ddl/triggers.sql index fd8e1a9ba..4feac80a6 100644 --- a/mssql/ddl/triggers.sql +++ b/mssql/ddl/triggers.sql @@ -41,5 +41,6 @@ BEGIN DELETE FROM Person_knows_Person WHERE Person2Id IN ( SELECT PersonId FROM DELETED ) DELETE FROM Person_workAt_Company WHERE PersonId IN ( SELECT PersonId FROM DELETED ) DELETE FROM Forum_hasMember_Person WHERE PersonId IN ( SELECT PersonId FROM DELETED ) + DELETE FROM Forum WHERE ModeratorPersonId IN ( SELECT PersonId FROM DELETED ) DELETE FROM Message WHERE CreatorPersonId IN ( SELECT PersonId FROM DELETED ) END; diff --git a/mssql/queries/interactive-complex-13.sql b/mssql/queries/interactive-complex-13.sql index b53ec8a24..29b7764c1 100644 --- a/mssql/queries/interactive-complex-13.sql +++ b/mssql/queries/interactive-complex-13.sql @@ -1,19 +1,3 @@ - --- SELECT levels --- , PersonId --- , Friends --- FROM (SELECT Person1.personId AS PersonId --- , STRING_AGG(Person2.personId, ';') WITHIN GROUP (GRAPH PATH) AS Friends --- , LAST_VALUE(Person2.personId) WITHIN GROUP (GRAPH PATH) AS LastNode --- , COUNT(Person2.personId) WITHIN GROUP (GRAPH PATH) AS levels --- FROM Person AS Person1 --- , Person_knows_Person FOR PATH AS fo --- , Person FOR PATH AS Person2 --- WHERE MATCH(SHORTEST_PATH(Person1(-(fo)->Person2)+)) --- AND Person1.personId = :person1Id --- ) AS Q --- WHERE Q.LastNode = :person2Id - DECLARE @trustedPaths as table ( Id bigint,