Merge remote-tracking branch 'upstream/master' into clicks-by-device-type
This commit is contained in:
commit
3152ecb228
68 changed files with 3472 additions and 34855 deletions
|
@ -2,34 +2,35 @@
|
|||
# Define incrementing schema version number
|
||||
SET @schema_version = '22';
|
||||
|
||||
# Add field device_type to campaign_tracker
|
||||
# Create table to store custom forms
|
||||
CREATE TABLE `custom_forms` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`list` int(11) unsigned NOT NULL,
|
||||
`name` varchar(255) DEFAULT '',
|
||||
`description` text,
|
||||
`fields_shown_on_subscribe` varchar(255) DEFAULT '',
|
||||
`fields_shown_on_manage` varchar(255) DEFAULT '',
|
||||
`layout` longtext,
|
||||
`form_input_style` longtext,
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `list` (`list`),
|
||||
CONSTRAINT `custom_forms_ibfk_1` FOREIGN KEY (`list`) REFERENCES `lists` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
# Create ALTER TABLE PROCEDURE
|
||||
DROP PROCEDURE IF EXISTS `alterbyregexp`;
|
||||
CREATE PROCEDURE `alterbyregexp` (`table_regexp` VARCHAR(255), `altertext` VARCHAR(255))
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE tbl VARCHAR(255);
|
||||
DECLARE curs CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema = (SELECT DATABASE()) and table_name like table_regexp;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
OPEN curs;
|
||||
# Create table to store custom form data
|
||||
CREATE TABLE `custom_forms_data` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`form` int(11) unsigned NOT NULL,
|
||||
`data_key` varchar(255) DEFAULT '',
|
||||
`data_value` longtext,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `form` (`form`),
|
||||
CONSTRAINT `custom_forms_data_ibfk_1` FOREIGN KEY (`form`) REFERENCES `custom_forms` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
read_loop: LOOP
|
||||
FETCH curs INTO tbl;
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
SET @query = CONCAT('ALTER TABLE `', tbl, '`' , altertext);
|
||||
PREPARE stmt FROM @query;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END LOOP;
|
||||
CLOSE curs;
|
||||
END;
|
||||
|
||||
# Add field device_type to campaign_tracker
|
||||
CALL alterbyregexp('campaign\_tracker%', 'ADD COLUMN `device_type` varchar(50) DEFAULT NULL AFTER `ip`');
|
||||
DROP PROCEDURE IF EXISTS `alterbyregexp`;
|
||||
# Add default_form to lists
|
||||
ALTER TABLE `lists` ADD COLUMN `default_form` int(11) unsigned DEFAULT NULL AFTER `cid`;
|
||||
|
||||
# Footer section
|
||||
LOCK TABLES `settings` WRITE;
|
||||
|
|
37
setup/sql/upgrade-00023.sql
Normal file
37
setup/sql/upgrade-00023.sql
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Header section
|
||||
# Define incrementing schema version number
|
||||
SET @schema_version = '23';
|
||||
|
||||
# Add field device_type to campaign_tracker
|
||||
|
||||
# Create ALTER TABLE PROCEDURE
|
||||
DROP PROCEDURE IF EXISTS `alterbyregexp`;
|
||||
CREATE PROCEDURE `alterbyregexp` (`table_regexp` VARCHAR(255), `altertext` VARCHAR(255))
|
||||
BEGIN
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
DECLARE tbl VARCHAR(255);
|
||||
DECLARE curs CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema = (SELECT DATABASE()) and table_name like table_regexp;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
OPEN curs;
|
||||
|
||||
read_loop: LOOP
|
||||
FETCH curs INTO tbl;
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
SET @query = CONCAT('ALTER TABLE `', tbl, '`' , altertext);
|
||||
PREPARE stmt FROM @query;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END LOOP;
|
||||
CLOSE curs;
|
||||
END;
|
||||
|
||||
# Add field device_type to campaign_tracker
|
||||
CALL alterbyregexp('campaign\_tracker%', 'ADD COLUMN `device_type` varchar(50) DEFAULT NULL AFTER `ip`');
|
||||
DROP PROCEDURE IF EXISTS `alterbyregexp`;
|
||||
|
||||
# Footer section
|
||||
LOCK TABLES `settings` WRITE;
|
||||
INSERT INTO `settings` (`key`, `value`) VALUES('db_schema_version', @schema_version) ON DUPLICATE KEY UPDATE `value`=@schema_version;
|
||||
UNLOCK TABLES;
|
Loading…
Add table
Add a link
Reference in a new issue