CREATE TABLE IF NOT EXISTS `visitorsblocked` (`vb_email` VARCHAR(512) NOT NULL , `vb_admin` VARCHAR(512) NOT NULL , `vb_when` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`vb_email`)) ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `visitorgroups` (`vg_id` INT NOT NULL AUTO_INCREMENT , `vg_name` VARCHAR(512) NOT NULL , `vg_created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , `vg_updated` DATETIME on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`vg_id`)) ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `visitorassoc` (`va_id` INT NOT NULL AUTO_INCREMENT , `va_visitor` VARCHAR(512) NOT NULL , `va_group` INT NOT NULL , PRIMARY KEY (`va_id`), INDEX (`va_visitor`), INDEX (`va_group`)) ENGINE = InnoDB;
ALTER TABLE `movies` ADD `mv_identify` TINYINT(1) NOT NULL DEFAULT '0' AFTER `mv_key`, ADD `mv_vsgroups` VARCHAR(256) NOT NULL DEFAULT '' AFTER `mv_identify`;
ALTER TABLE `movies` ADD `mv_fallback` VARCHAR(256) NOT NULL DEFAULT '' AFTER `mv_vsgroups`;
ALTER TABLE `assets` CHANGE `at_file1` `at_file1` TEXT, CHANGE `at_file2` `at_file2` TEXT, CHANGE `at_file3` `at_file3` TEXT, CHANGE `at_file4` `at_file4` TEXT, CHANGE `at_file5` `at_file5` TEXT;
CREATE TABLE IF NOT EXISTS `events` (`ev_id` int(11) NOT NULL AUTO_INCREMENT, `ev_date` datetime NOT NULL DEFAULT current_timestamp(), `ev_name` varchar(128) NOT NULL, `ev_movie` varchar(32) NOT NULL, `ev_moviename` varchar(256) NOT NULL, `ev_scene` varchar(32) NOT NULL, `ev_scenename` varchar(256) NOT NULL, `ev_visitor` varchar(256) NOT NULL, `ev_extra` text NOT NULL, PRIMARY KEY (`ev_id`), KEY `ev_date` (`ev_date`), KEY `ev_movie` (`ev_movie`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `cors` (`cr_domain` varchar(256) NOT NULL, PRIMARY KEY (`cr_domain`)) ENGINE=InnoDB;
INSERT INTO config (cf_key, cf_value) VALUES ('dbVersion', '2') ON DUPLICATE KEY UPDATE cf_value=VALUES(cf_value);