From 9942b886f22aec4e441824ffafb37422c82edc6b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 27 Oct 2017 12:04:42 -0700 Subject: [PATCH] conditionally add the standard layouts --- db/zm_update-1.31.12.sql | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/db/zm_update-1.31.12.sql b/db/zm_update-1.31.12.sql index a267728f5..deb97c777 100644 --- a/db/zm_update-1.31.12.sql +++ b/db/zm_update-1.31.12.sql @@ -21,3 +21,44 @@ SET @s = (SELECT IF( PREPARE stmt FROM @s; EXECUTE stmt; + +SET @s = ( SELECT IF( + (SELECT COUNT(*) FROM MontageLayouts WHERE Name='Freeform') > 0, + "SELECT 'Freeform already in layouts'", +"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('Freeform', '{ "default":{"float":"left"} }' );" +) ); +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = ( SELECT IF( + (SELECT COUNT(*) FROM MontageLayouts WHERE Name='2 Wide') > 0, + "SELECT '2 Wide already in layouts'", +"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('2 Wide', '{ "default":{"float":"left", "width":"49%"} }' );"; +) ); +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = ( SELECT IF( + (SELECT COUNT(*) FROM MontageLayouts WHERE Name='3 Wide') > 0, + "SELECT '3 Wide already in layouts'", +"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('3 Wide', '{ "default":{"float":"left", "width":"33%"} }' );" +) ); +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = ( SELECT IF( + (SELECT COUNT(*) FROM MontageLayouts WHERE Name='4 Wide') > 0, + "SELECT '4 Wide already in layouts'", +"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('4 Wide', '{ "default":{"float":"left", "width":"24.5%"} }' );" +) ); + +PREPARE stmt FROM @s; +EXECUTE stmt; +SET @s = ( SELECT IF( + (SELECT COUNT(*) FROM MontageLayouts WHERE Name='5 Wide') > 0, + "SELECT '5 Wide already in layouts'", + "INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('5 Wide', '{ "default":{"float":"left", "width":"19%"} }' );" +) ); + +PREPARE stmt FROM @s; +EXECUTE stmt;