diff options
Diffstat (limited to 'SQL/mssql.upgrade.sql')
-rw-r--r-- | SQL/mssql.upgrade.sql | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/SQL/mssql.upgrade.sql b/SQL/mssql.upgrade.sql index cf0c17157..4072c25ff 100644 --- a/SQL/mssql.upgrade.sql +++ b/SQL/mssql.upgrade.sql @@ -77,9 +77,10 @@ ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_c ON DELETE CASCADE ON UPDATE CASCADE
GO
-ALTER TABLE [dbo].[contactgroupmembers] ADD CONSTRAINT [FK_contactgroupmembers_contact_id]
- FOREIGN KEY ([contact_id]) REFERENCES [dbo].[contacts] ([contact_id])
- ON DELETE CASCADE ON UPDATE CASCADE
+CREATE TRIGGER [contact_delete_member] ON [dbo].[contacts]
+ AFTER DELETE AS
+ DELETE FROM [dbo].[contactgroupmembers]
+ WHERE [contact_id] IN (SELECT [contact_id] FROM deleted)
GO
ALTER TABLE [dbo].[contactgroups] ADD CONSTRAINT [FK_contactgroups_user_id]
|