-- phpMyAdmin SQL Dump
-- version 5.2.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Jan 06, 2026 at 06:24 PM
-- Server version: 12.1.2-MariaDB-log
-- PHP Version: 8.4.15

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `aether_dev`
--

-- --------------------------------------------------------

--
-- Table structure for table `event`
--

CREATE TABLE `event` (
  `id` int(11) NOT NULL,
  `id_random` varchar(22) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `code` varchar(100) DEFAULT NULL,
  `account_id` int(11) DEFAULT NULL,
  `poc_event_person_id` int(11) DEFAULT NULL COMMENT 'use this when possible',
  `poc_person_id` int(11) DEFAULT NULL COMMENT 'use this only if needed',
  `external_person_id` varchar(75) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'person ID generated by external system',
  `user_id` int(11) DEFAULT NULL COMMENT 'user that owns the event',
  `lu_event_type_id` int(11) DEFAULT NULL,
  `conference` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes allows for abstracts, sessions, presentations, presenters, badges, etc',
  `type` varchar(50) DEFAULT NULL,
  `name` varchar(200) NOT NULL,
  `summary` text DEFAULT NULL,
  `description` text DEFAULT NULL,
  `format` text DEFAULT NULL COMMENT 'format of the event',
  `lu_time_zone_id` int(11) DEFAULT NULL,
  `timezone` varchar(100) DEFAULT NULL,
  `start_datetime` datetime DEFAULT NULL,
  `end_datetime` datetime DEFAULT NULL,
  `recurring` tinyint(1) DEFAULT NULL COMMENT 'recurring event',
  `recurring_pattern` varchar(50) DEFAULT NULL,
  `recurring_start_time` time DEFAULT NULL COMMENT 'recurring event start time',
  `recurring_end_time` time DEFAULT NULL COMMENT 'recurring event end time',
  `recurring_text` text DEFAULT NULL COMMENT 'text describing how and when the event recurs',
  `weekday_sunday` tinyint(1) DEFAULT NULL,
  `weekday_monday` tinyint(1) DEFAULT NULL,
  `weekday_tuesday` tinyint(1) DEFAULT NULL,
  `weekday_wednesday` tinyint(1) DEFAULT NULL,
  `weekday_thursday` tinyint(1) DEFAULT NULL,
  `weekday_friday` tinyint(1) DEFAULT NULL,
  `weekday_saturday` tinyint(1) DEFAULT NULL,
  `address_location_id` int(11) DEFAULT NULL,
  `location_address_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
  `location_address_json_ext` longtext GENERATED ALWAYS AS (json_unquote(json_extract(`location_address_json`,'$'))) STORED,
  `location_text` text DEFAULT NULL COMMENT 'text information about the location',
  `online_start` datetime DEFAULT NULL,
  `online_end` datetime DEFAULT NULL,
  `reg_deadline_1` datetime DEFAULT NULL,
  `reg_deadline_2` datetime DEFAULT NULL,
  `reg_deadline_3` datetime DEFAULT NULL,
  `reg_deadline_4` datetime DEFAULT NULL,
  `max_registrants` int(11) DEFAULT NULL,
  `private` tinyint(1) DEFAULT 0 COMMENT 'invite only event',
  `physical` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'physical in person event',
  `virtual` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'virtual remote access event',
  `image_path` varchar(500) DEFAULT NULL,
  `logo_path` varchar(500) DEFAULT NULL,
  `logo_bg_color` varchar(25) DEFAULT NULL,
  `banner_path` varchar(500) DEFAULT NULL,
  `banner_bg_color` varchar(25) DEFAULT NULL,
  `logo_filename` varchar(200) DEFAULT NULL,
  `banner_image_filename` varchar(200) DEFAULT NULL,
  `banner_html` text DEFAULT NULL,
  `site_h1` varchar(500) DEFAULT NULL,
  `site_h2` varchar(500) DEFAULT NULL,
  `external_url` varchar(500) DEFAULT NULL,
  `external_url_text` varchar(500) DEFAULT NULL,
  `attend_url` varchar(500) DEFAULT NULL,
  `attend_url_text` varchar(500) DEFAULT NULL,
  `attend_url_code` varchar(50) DEFAULT NULL COMMENT 'id, code, nickname, alias',
  `attend_url_passcode` varchar(50) DEFAULT NULL,
  `attend_phone` varchar(50) DEFAULT NULL,
  `attend_phone_passcode` varchar(50) DEFAULT NULL,
  `attend_text` text DEFAULT NULL,
  `attend_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`attend_json`)),
  `contact_1_id` int(11) DEFAULT NULL,
  `contact_2_id` int(11) DEFAULT NULL,
  `contact_3_id` int(11) DEFAULT NULL,
  `contact_li_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`contact_li_json`)),
  `contact_li_json_ext` longtext GENERATED ALWAYS AS (json_unquote(json_extract(`contact_li_json`,'$'))) STORED,
  `contact_name` varchar(200) DEFAULT NULL,
  `contact_email` varchar(254) DEFAULT NULL,
  `contact_phone` varchar(50) DEFAULT NULL,
  `contact_other` text DEFAULT NULL,
  `contact_text` text DEFAULT NULL,
  `event_file_upload_information` text DEFAULT NULL,
  `enable` tinyint(1) NOT NULL DEFAULT 1,
  `enable_from` datetime DEFAULT NULL,
  `enable_to` datetime DEFAULT NULL,
  `enable_for_administrator` tinyint(1) NOT NULL DEFAULT 0,
  `enable_for_support` tinyint(1) NOT NULL DEFAULT 0,
  `enable_for_assistant` tinyint(1) NOT NULL DEFAULT 0,
  `enable_for_trusted` tinyint(1) NOT NULL DEFAULT 0,
  `enable_for_authenticated` tinyint(1) NOT NULL DEFAULT 0,
  `enable_for_anonymous` tinyint(1) NOT NULL DEFAULT 0,
  `enable_comments` tinyint(1) NOT NULL DEFAULT 0,
  `send_moderator_email` tinyint(1) DEFAULT NULL,
  `moderator_email` varchar(254) DEFAULT NULL,
  `disable_navigation` tinyint(1) NOT NULL DEFAULT 0,
  `enable_event_file_upload_for_event` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_for_location` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_for_session` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_for_presentation` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_for_presenter` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_review_question` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_email_question` tinyint(1) DEFAULT NULL,
  `enable_event_file_upload_comments_question` tinyint(1) DEFAULT NULL,
  `enable_event_file_approval_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_public_use_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_member_use_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_attendee_use_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_publish_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_purpose_option` tinyint(1) DEFAULT NULL,
  `enable_event_file_os_selection_option` tinyint(1) DEFAULT NULL COMMENT 'allow selection between macOS and Windows',
  `enable_event_file_os_change_option` tinyint(1) DEFAULT NULL,
  `custom_event_file_upload_description` text DEFAULT NULL,
  `custom_event_file_agreement_1_text` text DEFAULT NULL,
  `custom_event_file_agreement_1_description` text DEFAULT NULL,
  `ask_speaker_ready_room` tinyint(1) DEFAULT NULL,
  `ask_presentation_publish_optout` tinyint(1) DEFAULT NULL,
  `default_event_file_to_public_use` tinyint(1) DEFAULT NULL,
  `ask_for_public_version` tinyint(1) DEFAULT NULL,
  `hide_file_upload_presentation_name` tinyint(1) DEFAULT NULL,
  `hide_session_codes` tinyint(1) DEFAULT NULL,
  `custom_agreement_1_text` text DEFAULT NULL,
  `custom_agreement_1_description` text DEFAULT NULL,
  `unauthenticated_access` tinyint(1) NOT NULL DEFAULT 0,
  `unauthenticated_access_public_endpoint` tinyint(1) NOT NULL DEFAULT 0,
  `mod_abstracts_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_abstracts_json`)),
  `mod_badges_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'badges config options' CHECK (json_valid(`mod_badges_json`)),
  `mod_exhibits_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'exhibits config options' CHECK (json_valid(`mod_exhibits_json`)),
  `mod_meetings_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_meetings_json`)),
  `mod_pres_mgmt_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`mod_pres_mgmt_json`)),
  `cfg_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'config in JSON format' CHECK (json_valid(`cfg_json`)),
  `hide` tinyint(1) DEFAULT NULL,
  `status` varchar(25) DEFAULT NULL,
  `review` tinyint(1) DEFAULT NULL,
  `approve` tinyint(1) DEFAULT NULL,
  `ready` tinyint(1) DEFAULT NULL,
  `ready_on` datetime DEFAULT NULL,
  `archive` tinyint(1) DEFAULT NULL,
  `archive_on` datetime DEFAULT NULL,
  `priority` tinyint(1) DEFAULT NULL,
  `sort` int(11) DEFAULT NULL,
  `group` varchar(100) DEFAULT NULL,
  `default_qry_str` text DEFAULT NULL COMMENT 'for FULLTEXT indexed searches',
  `notes` text DEFAULT NULL,
  `created_on` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_on` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Triggers `event`
--
DELIMITER $$
CREATE TRIGGER `before_insert_event` BEFORE INSERT ON `event` FOR EACH ROW BEGIN
    BEGIN
        IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
        THEN
            /* SET NEW.id_random = gen_rand_pattern('3C-2N-2N-2N'); */
            /* SET NEW.id_random = gen_rand_pattern('4C-2N-2N-2N'); */
            SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
            /* SET NEW.id_random = gen_rand_str(11, 'URL'); */
        END IF;
        
        SET NEW.default_qry_str = event_default_qry_str(NEW.id_random, NEW.type, NEW.name, NEW.description, NEW.timezone, NEW.recurring_pattern, NEW.recurring_text, NEW.location_text, NEW.attend_text, NEW.contact_text);
    END;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `before_update_event` BEFORE UPDATE ON `event` FOR EACH ROW BEGIN
    BEGIN
        IF (NEW.id_random IS NULL OR NEW.id_random = '' OR LENGTH(NEW.id_random) < 6)
        THEN
            SET NEW.id_random = gen_rand_pattern('3CN-2CN-2CN-2CN');
        END IF;
        
        SET NEW.default_qry_str = event_default_qry_str(NEW.id_random, NEW.type, NEW.name, NEW.description, NEW.timezone, NEW.recurring_pattern, NEW.recurring_text, NEW.location_text, NEW.attend_text, NEW.contact_text);
    END;
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `event_after_delete` AFTER DELETE ON `event` FOR EACH ROW BEGIN
DELETE FROM event_person WHERE event_person.id = old.poc_event_person_id;
DELETE FROM address WHERE address.for_id = old.id AND address.for_type = 'event';
DELETE FROM address WHERE address.id = old.address_location_id;
DELETE FROM contact WHERE contact.for_id = old.id AND contact.for_type = 'event';
DELETE FROM contact WHERE contact.id = old.contact_1_id;
DELETE FROM contact WHERE contact.id = old.contact_2_id;
DELETE FROM contact WHERE contact.id = old.contact_3_id;
END
$$
DELIMITER ;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `event`
--
ALTER TABLE `event`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `id_random` (`id_random`),
  ADD KEY `account_id` (`account_id`),
  ADD KEY `created_on` (`created_on`),
  ADD KEY `updated_on` (`updated_on`),
  ADD KEY `sort` (`sort`),
  ADD KEY `conference` (`conference`),
  ADD KEY `enable` (`enable`),
  ADD KEY `archive` (`archive`),
  ADD KEY `address_location_id` (`address_location_id`) USING HASH,
  ADD KEY `poc_event_person_id` (`poc_event_person_id`) USING HASH,
  ADD KEY `contact_id_1` (`contact_1_id`) USING HASH,
  ADD KEY `contact_id_2` (`contact_2_id`) USING HASH,
  ADD KEY `priority` (`priority`),
  ADD KEY `hide` (`hide`);
ALTER TABLE `event` ADD FULLTEXT KEY `tbl_fulltext_default_qry_str` (`default_qry_str`);
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_location_address_json` (`location_address_json`);
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_contact_li_json` (`contact_li_json`);
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_location_address_json_ext` (`location_address_json_ext`);
ALTER TABLE `event` ADD FULLTEXT KEY `fulltext_contact_li_json_ext` (`contact_li_json_ext`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `event`
--
ALTER TABLE `event`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
