2017-10-28 00:57:41 +08:00
|
|
|
--
|
|
|
|
-- This adds Manufacturers and Models
|
|
|
|
--
|
|
|
|
|
|
|
|
SET @s = (SELECT IF(
|
|
|
|
(SELECT COUNT(*)
|
|
|
|
FROM INFORMATION_SCHEMA.TABLES
|
|
|
|
WHERE table_name = 'MontageLayouts'
|
|
|
|
AND table_schema = DATABASE()
|
|
|
|
) > 0,
|
|
|
|
"SELECT 'MontageLayouts table exists'",
|
|
|
|
"
|
|
|
|
CREATE TABLE MontageLayouts (
|
|
|
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
|
|
|
`Name` TEXT NOT NULL,
|
2017-11-01 23:05:21 +08:00
|
|
|
`Positions` LONGTEXT,
|
2017-10-28 00:57:41 +08:00
|
|
|
PRIMARY KEY (`Id`)
|
|
|
|
);
|
|
|
|
"
|
|
|
|
));
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
2017-10-28 03:04:42 +08:00
|
|
|
|
|
|
|
SET @s = ( SELECT IF(
|
|
|
|
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='Freeform') > 0,
|
|
|
|
"SELECT 'Freeform already in layouts'",
|
2017-10-31 09:38:27 +08:00
|
|
|
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'Freeform\', \'{"default":{"float":"left","position":"relative"}}\');'
|
2017-10-28 03:04:42 +08:00
|
|
|
) );
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
|
|
|
|
|
|
|
SET @s = ( SELECT IF(
|
|
|
|
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='2 Wide') > 0,
|
2017-10-30 21:05:08 +08:00
|
|
|
"SELECT '2 Wide already in layouts'",
|
2017-10-31 09:38:27 +08:00
|
|
|
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'2 Wide\', \'{"default":{"float":"left","position":"relative","width":"49%"}}\');'
|
2017-10-28 03:04:42 +08:00
|
|
|
) );
|
|
|
|
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'",
|
2017-10-31 09:38:27 +08:00
|
|
|
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'3 Wide\', \'{"default":{"float":"left","position":"relative","width":"33%"}}\');'
|
2017-10-28 03:04:42 +08:00
|
|
|
) );
|
|
|
|
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'",
|
2017-10-31 09:38:27 +08:00
|
|
|
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'4 Wide\', \'{"default":{"float":"left","position":"relative","width":"24.5%"}}\');'
|
2017-10-28 03:04:42 +08:00
|
|
|
) );
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|
2017-10-30 21:05:08 +08:00
|
|
|
|
2017-10-28 03:04:42 +08:00
|
|
|
SET @s = ( SELECT IF(
|
|
|
|
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='5 Wide') > 0,
|
|
|
|
"SELECT '5 Wide already in layouts'",
|
2017-10-31 09:38:27 +08:00
|
|
|
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'5 Wide\', \'{"default":{"float":"left","position":"relative","width":"19%"}}\' );'
|
2017-10-28 03:04:42 +08:00
|
|
|
) );
|
|
|
|
|
|
|
|
PREPARE stmt FROM @s;
|
|
|
|
EXECUTE stmt;
|