summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-15 14:03:22 +0000
committeralecpl <alec@alec.pl>2010-11-15 14:03:22 +0000
commit8710133250ec58bb9572bce0d3e13e232b60d17a (patch)
treef3cdd7c8e5cdd571a1ecd154a024f02c3065d12e
parent3e54812afa0db1eeb201c3faa53911f51d91d3e1 (diff)
- Fix error in MSSQL DDL scripts (#1487112): use trigger instead of foreign key constraint
-rw-r--r--CHANGELOG1
-rw-r--r--SQL/mssql.initial.sql9
-rw-r--r--SQL/mssql.upgrade.sql7
3 files changed, 11 insertions, 6 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 871bc3174..be351680c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -71,6 +71,7 @@ CHANGELOG Roundcube Webmail
- jQuery 1.4.4
- Fix handling of HTML entity strings in plain text messages
- Fix focused elements aren't unfocused when clicking on the list (#1487123)
+- Fix error in MSSQL DDL scripts (#1487112)
RELEASE 0.4.2
-------------
diff --git a/SQL/mssql.initial.sql b/SQL/mssql.initial.sql
index 36788585f..823d1b3ae 100644
--- a/SQL/mssql.initial.sql
+++ b/SQL/mssql.initial.sql
@@ -291,8 +291,11 @@ 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
+-- Use trigger instead of foreign key (#1487112)
+-- "Introducing FOREIGN KEY constraint ... may cause cycles or multiple cascade paths."
+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
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]