[Svn] r4226 - in trunk/roundcubemail: . SQL

trac at roundcube.net trac at roundcube.net
Mon Nov 15 15:03:23 CET 2010


Author: alec
Date: 2010-11-15 08:03:22 -0600 (Mon, 15 Nov 2010)
New Revision: 4226

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/SQL/mssql.initial.sql
   trunk/roundcubemail/SQL/mssql.upgrade.sql
Log:
- Fix error in MSSQL DDL scripts (#1487112): use trigger instead of foreign key constraint


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-11-15 10:01:49 UTC (rev 4225)
+++ trunk/roundcubemail/CHANGELOG	2010-11-15 14:03:22 UTC (rev 4226)
@@ -71,6 +71,7 @@
 - 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
 -------------

Modified: trunk/roundcubemail/SQL/mssql.initial.sql
===================================================================
--- trunk/roundcubemail/SQL/mssql.initial.sql	2010-11-15 10:01:49 UTC (rev 4225)
+++ trunk/roundcubemail/SQL/mssql.initial.sql	2010-11-15 14:03:22 UTC (rev 4226)
@@ -291,8 +291,11 @@
     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
 

Modified: trunk/roundcubemail/SQL/mssql.upgrade.sql
===================================================================
--- trunk/roundcubemail/SQL/mssql.upgrade.sql	2010-11-15 10:01:49 UTC (rev 4225)
+++ trunk/roundcubemail/SQL/mssql.upgrade.sql	2010-11-15 14:03:22 UTC (rev 4226)
@@ -77,9 +77,10 @@
     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]

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list