You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2015/03/09 17:28:11 UTC
svn commit: r1665294 - /vcl/trunk/mysql/update-vcl.sql
Author: jfthomps
Date: Mon Mar 9 16:28:10 2015
New Revision: 1665294
URL: http://svn.apache.org/r1665294
Log:
VCL-764 - Database changes for VCL 2.4
update-vcl.sql: modified AddConstraintIfNotExists: extended to accept 'nullCASCADE' for constraintAction with constraintType is both; this causes the constraint to be set as "ON DELETE SET NULL ON UPDATE CASCADE"; modified constraint for image.imagemetaid to call AddConstraintIfNotExists with nullCASCADE for constraintAction so things will match what is in vcl.sql (and allow entries in imagemeta to be deleted)
Modified:
vcl/trunk/mysql/update-vcl.sql
Modified: vcl/trunk/mysql/update-vcl.sql
URL: http://svn.apache.org/viewvc/vcl/trunk/mysql/update-vcl.sql?rev=1665294&r1=1665293&r2=1665294&view=diff
==============================================================================
--- vcl/trunk/mysql/update-vcl.sql (original)
+++ vcl/trunk/mysql/update-vcl.sql Mon Mar 9 16:28:10 2015
@@ -330,6 +330,8 @@ BEGIN
SET @statement_array = CONCAT('ALTER TABLE `', Database(), '`.', tableName, ' ADD FOREIGN KEY (', columnName, ') REFERENCES `', Database(), '`.', referencedTableName, ' (', referencedColumnName, ') ON UPDATE ', constraintAction);
ELSEIF constraintType = 'delete' THEN
SET @statement_array = CONCAT('ALTER TABLE `', Database(), '`.', tableName, ' ADD FOREIGN KEY (', columnName, ') REFERENCES `', Database(), '`.', referencedTableName, ' (', referencedColumnName, ') ON DELETE ', constraintAction);
+ ELSEIF constraintType = 'both' AND constraintAction = 'nullCASCADE' THEN
+ SET @statement_array = CONCAT('ALTER TABLE `', Database(), '`.', tableName, ' ADD FOREIGN KEY (', columnName, ') REFERENCES `', Database(), '`.', referencedTableName, ' (', referencedColumnName, ') ON DELETE SET NULL ON UPDATE CASCADE');
ELSEIF constraintType = 'both' THEN
SET @statement_array = CONCAT('ALTER TABLE `', Database(), '`.', tableName, ' ADD FOREIGN KEY (', columnName, ') REFERENCES `', Database(), '`.', referencedTableName, ' (', referencedColumnName, ') ON DELETE ', constraintAction, ' ON UPDATE ', constraintAction);
ELSE
@@ -2013,7 +2015,7 @@ CALL AddConstraintIfNotExists('connectlo
--
CALL AddConstraintIfNotExists('image', 'imagetypeid', 'imagetype', 'id', 'update', 'CASCADE');
-CALL AddConstraintIfNotExists('image', 'imagemetaid', 'imagemeta', 'id', 'update', 'CASCADE');
+CALL AddConstraintIfNotExists('image', 'imagemetaid', 'imagemeta', 'id', 'both', 'nullCASCADE');
-- --------------------------------------------------------