CREATE TABLE IF NOT EXISTS `assets` (`at_uid` int(11) NOT NULL AUTO_INCREMENT,`at_id` varchar(32) NOT NULL,`at_collection` varchar(64) NOT NULL,`at_order` int(11) NOT NULL DEFAULT 0,`at_name` varchar(256) NOT NULL,`at_type` varchar(16) NOT NULL,`at_time` decimal(8,4) NOT NULL DEFAULT 5.0000,`at_action` text,`at_frames` int(11) NOT NULL DEFAULT 1,`at_frtime` int(11) NOT NULL DEFAULT 100,`at_file1` varchar(1024) NOT NULL,`at_file2` varchar(1024) NOT NULL,`at_file3` varchar(1024) NOT NULL,`at_file4` varchar(1024) NOT NULL,`at_file5` varchar(1024) NOT NULL,PRIMARY KEY (`at_uid`),KEY `at_id` (`at_id`),KEY `at_collection` (`at_collection`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `collections` (`cl_uid` varchar(64) NOT NULL,`cl_id` varchar(32) NOT NULL,`cl_movie` varchar(32) NOT NULL,`cl_title` varchar(256) NOT NULL,`cl_transition` varchar(8) NOT NULL DEFAULT 'alpha',`cl_time` decimal(8,4) NOT NULL DEFAULT 1.0000,PRIMARY KEY (`cl_uid`),KEY `cl_id` (`cl_id`),KEY `cl_movie` (`cl_movie`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `config` (`cf_key` varchar(16) NOT NULL,`cf_value` text,PRIMARY KEY (`cf_key`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `fonts` (`fn_name` varchar(128) NOT NULL,`fn_file` varchar(512) NOT NULL,PRIMARY KEY (`fn_name`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `instancedesc` (`id_id` int(11) NOT NULL AUTO_INCREMENT,`id_instance` int(11) NOT NULL,`id_position` varchar(1) NOT NULL,`id_order` tinyint(4) NOT NULL DEFAULT 0,`id_x` int(11) NOT NULL DEFAULT 0,`id_y` int(11) NOT NULL DEFAULT 0,`id_alpha` decimal(4,3) NOT NULL DEFAULT 1.000,`id_width` int(11) NOT NULL DEFAULT 64,`id_height` int(11) NOT NULL DEFAULT 64,`id_rotation` int(11) NOT NULL DEFAULT 0,`id_visible` tinyint(4) NOT NULL DEFAULT 1,`id_color` varchar(8) NOT NULL DEFAULT '0x000000',`id_coloralpha` decimal(4,3) NOT NULL DEFAULT 0.000,`id_volume` decimal(5,0) NOT NULL DEFAULT 1,`id_pan` decimal(5,3) NOT NULL DEFAULT 0.000,`id_blur` varchar(128) NOT NULL DEFAULT '',`id_dropshadow` varchar(128) NOT NULL DEFAULT '',`id_textfont` varchar(128) NOT NULL DEFAULT '',`id_textsize` tinyint(4) NOT NULL DEFAULT 12,`id_textcolor` varchar(8) NOT NULL DEFAULT '0xFFFFFF',`id_textbold` tinyint(4) NOT NULL DEFAULT 0,`id_textitalic` tinyint(4) NOT NULL DEFAULT 0,`id_textleading` tinyint(4) NOT NULL DEFAULT 0,`id_textspacing` tinyint(4) NOT NULL DEFAULT 0,`id_textbackground` varchar(8) NOT NULL DEFAULT '',`id_textalign` varchar(8) NOT NULL DEFAULT 'left',PRIMARY KEY (`id_id`),KEY `id_instance` (`id_instance`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `instances` (`in_id` int(11) NOT NULL AUTO_INCREMENT,`in_keyframe` int(11) NOT NULL,`in_name` varchar(32) NOT NULL,`in_collection` varchar(32) NOT NULL,`in_asset` varchar(32) NOT NULL,`in_action` text,`in_play` tinyint(4) NOT NULL DEFAULT 1,PRIMARY KEY (`in_id`),KEY `in_keyframe` (`in_keyframe`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `keyframes` (`kf_id` int(11) NOT NULL AUTO_INCREMENT,`kf_scene` int(11) NOT NULL,`kf_order` tinyint(4) NOT NULL,PRIMARY KEY (`kf_id`),KEY `kf_scene` (`kf_scene`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `movies` (`mv_id` varchar(32) NOT NULL,`mv_user` varchar(256) NOT NULL,`mv_collaborators` varchar(2048) NOT NULL DEFAULT '',`mv_author` varchar(256) NOT NULL,`mv_title` varchar(512) NOT NULL,`mv_about` varchar(2048) NOT NULL DEFAULT '',`mv_copyright` varchar(128) NOT NULL DEFAULT '',`mv_copyleft` varchar(128) NOT NULL DEFAULT '',`mv_tags` varchar(1024) NOT NULL DEFAULT '',`mv_favicon` varchar(1024) NOT NULL DEFAULT '',`mv_image` varchar(1024) NOT NULL DEFAULT '',`mv_key` varchar(32) NOT NULL DEFAULT '',`mv_start` varchar(32) NOT NULL DEFAULT '',`mv_acstart` text,`mv_screenbig` int(11) NOT NULL DEFAULT 1920,`mv_screensmall` int(11) NOT NULL DEFAULT 1080,`mv_screentype` varchar(16) NOT NULL DEFAULT 'both',`mv_screenbg` varchar(8) NOT NULL DEFAULT '0x000000',`mv_interval` decimal(3,2) NOT NULL DEFAULT 1.00,`mv_origin` varchar(16) NOT NULL DEFAULT 'center',`mv_animation` varchar(16) NOT NULL DEFAULT 'linear',`mv_fonts` text,`mv_style` longtext,`mv_actions` longtext,`mv_theme` text,`mv_texts` longtext,`mv_numbers` longtext,`mv_flags` longtext,`mv_plugins` varchar(1024) NOT NULL DEFAULT '',`mv_created` datetime NOT NULL DEFAULT current_timestamp(),`mv_updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),PRIMARY KEY (`mv_id`),KEY `mv_title` (`mv_title`),KEY `mv_updated` (`mv_updated`),KEY `mv_user` (`mv_user`),KEY `mv_collaborators` (`mv_collaborators`(768)),KEY `mv_collaborators_2` (`mv_collaborators`(768))) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `overlay_plugin` (`op_key` varchar(32) NOT NULL,`op_url` varchar(2048) NOT NULL,`op_request` longtext,`op_return` longtext,`op_closed` tinyint(4) NOT NULL DEFAULT 0,`op_created` datetime NOT NULL DEFAULT current_timestamp(),`op_updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),PRIMARY KEY (`op_key`),KEY `op_created` (`op_created`),KEY `op_updated` (`op_updated`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `pluginconfig` (`pc_id` varchar(64) NOT NULL,`pc_active` tinyint(4) NOT NULL DEFAULT 1,`pc_setup` longtext,`pc_file` varchar(64) NOT NULL,`pc_index` tinyint(4) NOT NULL DEFAULT 0,`pc_ws` tinyint(4) NOT NULL DEFAULT 0,PRIMARY KEY (`pc_id`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `plugins` (`pl_id` varchar(128) NOT NULL,`pl_name` varchar(64) NOT NULL,`pl_movie` varchar(64) NOT NULL,`pl_scene` varchar(64) NOT NULL,`pl_config` longtext,PRIMARY KEY (`pl_id`),KEY `pl_name` (`pl_name`),KEY `pl_movie` (`pl_movie`,`pl_scene`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `scenes` (`sc_uid` int(11) NOT NULL AUTO_INCREMENT,`sc_id` varchar(32) NOT NULL,`sc_movie` varchar(32) NOT NULL,`sc_published` tinyint(4) NOT NULL DEFAULT 0,`sc_title` varchar(256) NOT NULL,`sc_about` varchar(2048) NOT NULL DEFAULT '',`sc_image` varchar(1024) NOT NULL DEFAULT '',`sc_up` varchar(32) NOT NULL DEFAULT '',`sc_down` varchar(32) NOT NULL DEFAULT '',`sc_left` varchar(32) NOT NULL DEFAULT '',`sc_right` varchar(32) NOT NULL DEFAULT '',`sc_nin` varchar(32) NOT NULL DEFAULT '',`sc_nout` varchar(32) NOT NULL DEFAULT '',`sc_collections` varchar(2048) NOT NULL DEFAULT '',`sc_loop` tinyint(4) NOT NULL DEFAULT 0,`sc_acstart` text,`sc_ackeyframes` mediumtext,`sc_user` varchar(512) NOT NULL,`sc_date` datetime NOT NULL DEFAULT current_timestamp(),PRIMARY KEY (`sc_uid`),KEY `sc_id` (`sc_id`),KEY `sc_movie` (`sc_movie`),KEY `sc_published` (`sc_published`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `users` (`us_email` varchar(256) NOT NULL,`us_pass` varchar(32) NOT NULL,`us_passtemp` varchar(32) NOT NULL,`us_key` varchar(32) NOT NULL,`us_level` tinyint(4) NOT NULL,`us_created` datetime NOT NULL DEFAULT current_timestamp(),`us_updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),PRIMARY KEY (`us_email`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `visitordata` (`vd_id` varchar(128) NOT NULL,`vd_movie` varchar(64) NOT NULL,`vd_user` varchar(128) NOT NULL,`vd_name` varchar(64) NOT NULL,`vd_value` mediumtext,`vd_created` datetime NOT NULL DEFAULT current_timestamp(),`vd_updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),PRIMARY KEY (`vd_id`),KEY `vd_movie` (`vd_movie`),KEY `vd_user` (`vd_user`),KEY `vd_name` (`vd_name`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `visitors` (`vs_email` varchar(256) NOT NULL,`vs_key` varchar(32) NOT NULL,`vs_created` datetime NOT NULL DEFAULT current_timestamp(),`vs_last` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),`vs_code` varchar(8) NOT NULL,`vs_level` tinyint(4) NOT NULL DEFAULT 100,PRIMARY KEY (`vs_email`)) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `visitorstate` (`vs_id` varchar(128) NOT NULL,`vs_movie` varchar(64) NOT NULL,`vs_user` varchar(128) NOT NULL,`vs_quick` tinyint(4) NOT NULL DEFAULT 0,`vs_scene` varchar(64) NOT NULL,`vs_about` varchar(512) NOT NULL DEFAULT '',`vs_value` mediumtext,`vs_created` datetime NOT NULL DEFAULT current_timestamp(),`vs_updated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),PRIMARY KEY (`vs_id`),KEY `vs_movie` (`vs_movie`),KEY `vs_user` (`vs_user`),KEY `vs_quick` (`vs_quick`)) ENGINE=InnoDB;
INSERT IGNORE INTO `config` (`cf_key`, `cf_value`) VALUES ('fpsMode', '30'),('renderMode', 'webgl'),('shareMode', 'scene'),('dbVersion', '1');
INSERT IGNORE INTO `fonts` (`fn_name`, `fn_file`) VALUES ('Averia Serif GWF', 'averiaserifgwf.woff2'), ('Liberation Serif', 'liberationserif.woff2'), ('Libra Sans', 'librasans.woff2'), ('Roboto Sans', 'roboto.woff2');