-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `humati_book`
--

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

--
-- Table structure for table `calendar_event_master`
--

CREATE TABLE `calendar_event_master` (
  `id` int(10) UNSIGNED NOT NULL,
  `event_type_id` int(10) UNSIGNED NOT NULL COMMENT 'From event_type_master',
  `login_id` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `team_id` int(10) UNSIGNED NOT NULL COMMENT 'From team_master',
  `calendar_connection_id` int(10) UNSIGNED NOT NULL COMMENT 'From calendar_connection_master',
  `google_event_id` text NOT NULL COMMENT 'id from Google Calendar',
  `first_name` varchar(150) NOT NULL,
  `last_name` varchar(150) NOT NULL,
  `full_name` varchar(255) NOT NULL,
  `email` varchar(100) NOT NULL,
  `additional_guest_email` text NOT NULL,
  `event_location` varchar(255) NOT NULL,
  `event_title` varchar(250) NOT NULL,
  `event_description` text NOT NULL,
  `event_timezone` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_date` date NOT NULL,
  `end_time` time NOT NULL,
  `is_duration` tinyint(1) UNSIGNED NOT NULL COMMENT '0.No, 1.Yes',
  `event_duration` varchar(10) NOT NULL COMMENT 'In minute',
  `is_repeat` tinyint(1) NOT NULL COMMENT '0:No, 1:Yes',
  `repeat_type` tinyint(1) NOT NULL COMMENT '1.Daily, 2.Weekly, 3.Monthly, 4.Yearly.(is_repeat =1)',
  `every_years` tinyint(2) NOT NULL COMMENT '(is_repeat=1, repeat_type=4)',
  `daily_type` tinyint(1) NOT NULL COMMENT '1.N Days, 2.Weekdays, 3.Weekends.(is_repeat=1, repeat_type=1)',
  `every_days` tinyint(2) NOT NULL COMMENT '(is_repeat=1,repeat_type=1, daily_type=1)',
  `every_weeks` tinyint(2) NOT NULL COMMENT '(is_repeat=1, repeat_type=2)',
  `every_weekon_mon` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_tue` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_wed` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_thu` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_fri` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_sat` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `every_weekon_sun` tinyint(1) NOT NULL COMMENT '1.Yes, 0.No.(is_repeat=1, repeat_type=2)',
  `monthly_type` tinyint(1) NOT NULL COMMENT '1.Date-Month, 2.Nth Date-Month.(is_repeat =1, repeat_type=3)',
  `month_date` tinyint(2) NOT NULL COMMENT '(is_repeat=1, repeat_type=3, month_type=1)',
  `month_count` tinyint(2) NOT NULL COMMENT '(is_repeat=1, repeat_type=3, month_type=1)',
  `nth_day` tinyint(1) NOT NULL COMMENT '1.First,2.Second,…,5.Last.(is_repeat=1, repeat_type=3, month_type=2)',
  `nth_date` tinyint(2) NOT NULL COMMENT '1.Day,2.Weekday,3.Weekend,4.Mon,5.Tue,6.Wed,7.Thu,8.Fri,9.Sat,10.Sun (is_repeat=1, repeat_type=3, month_type=2)',
  `nth_month_count` tinyint(2) NOT NULL COMMENT 'is_repeat=1, repeat_type=3, month_type=2',
  `end_template_type` tinyint(1) NOT NULL COMMENT '1.Never, 2.After N occurrence, 3.Date-Time (is_repeat=1)',
  `end_counter` int(4) NOT NULL COMMENT '(is_repeat=1, end_template_type=2)',
  `end_template_date` date NOT NULL COMMENT '(is_repeat=1, end_template_type=3)',
  `end_template_time` time NOT NULL COMMENT '(is_repeat=1, end_template_type=3)',
  `is_updated_event` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_deleted_event` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `created_date` datetime NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `modified_date` datetime NOT NULL,
  `modified_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0.Deactive, 1.Active(Default), 2. Archive'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `calendar_repeat_trans`
--

CREATE TABLE `calendar_repeat_trans` (
  `id` int(10) UNSIGNED NOT NULL,
  `calendar_event_id` int(10) UNSIGNED NOT NULL COMMENT 'From calendar_event_master',
  `start_date` date NOT NULL,
  `start_time` time NOT NULL,
  `end_date` date NOT NULL,
  `end_time` time NOT NULL,
  `event_title` varchar(255) NOT NULL,
  `event_description` text NOT NULL,
  `edit_flag` tinyint(1) NOT NULL,
  `reminder_email_date` datetime NOT NULL COMMENT 'Reminder Date To Email Notification',
  `reminder_popup_date` datetime NOT NULL COMMENT 'Reminder Date To Pop-Up Notification',
  `is_close` tinyint(1) NOT NULL COMMENT '0.Open Popup, 1.Not Open Popup (For reminder popup)',
  `is_mail_sent` tinyint(1) NOT NULL COMMENT '0: No, 1: Yes (For reminder email)',
  `original_start_datetime` datetime NOT NULL COMMENT 'If single event edited from recurrence.',
  `is_deleted_event` tinyint(1) NOT NULL COMMENT '0: No, 1: Yes',
  `event_status` tinyint(1) NOT NULL COMMENT '1- Open, 2- Doing, 3- Done',
  `event_completed_date` datetime NOT NULL,
  `event_completed_by` int(10) UNSIGNED NOT NULL COMMENT 'id from login_master',
  `is_cancelled_event` tinyint(1) NOT NULL COMMENT '0:No, 1:Yes',
  `created_by` int(10) UNSIGNED NOT NULL COMMENT 'id from login_master',
  `created_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ci_sessions`
--

CREATE TABLE `ci_sessions` (
  `id` varchar(128) NOT NULL,
  `ip_address` varchar(45) NOT NULL,
  `timestamp` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `data` blob NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `event_type_master`
--

CREATE TABLE `event_type_master` (
  `id` int(10) UNSIGNED NOT NULL,
  `login_id` int(10) UNSIGNED NOT NULL COMMENT 'From login_master  (If event type is created for user)',
  `team_id` int(10) UNSIGNED NOT NULL COMMENT 'From team_master (If event type is created for team)',
  `access_level` tinyint(1) UNSIGNED NOT NULL COMMENT ' 1-Personal, 2-Professional, 3-Primerica, 4- Access Support',
  `event_type` tinyint(1) UNSIGNED NOT NULL COMMENT '1.One-on-one, 2. Group, 3. Collective',
  `event_name` varchar(255) NOT NULL,
  `location_type` tinyint(2) NOT NULL COMMENT '1.In-person meeting, 2.Phone call, 3.Google Meet, 4.Microsoft Teams, 5.GoToMeeting, 6.Custom, 7.Ask invitee',
  `event_location` varchar(255) NOT NULL,
  `event_description` text NOT NULL,
  `event_link` varchar(255) NOT NULL COMMENT 'Unique slug (Used to share link with other)',
  `event_color` varchar(20) NOT NULL COMMENT 'Color code',
  `event_duration` int(5) UNSIGNED NOT NULL COMMENT 'Minutes (How long event will be. 15min, 30min)',
  `when_scheduled` tinyint(1) NOT NULL COMMENT '1. Over a period of rolling days, 2. Indefinitely',
  `number_of_days` tinyint(3) NOT NULL COMMENT 'If when_scheduled=1',
  `days_type` tinyint(1) NOT NULL COMMENT '1. Calendar days, 2. Business days (mon-fri)',
  `event_time_zone` varchar(255) NOT NULL,
  `hide_event` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `max_invitee` tinyint(3) NOT NULL COMMENT 'If event_type=2',
  `host_id` varchar(255) NOT NULL COMMENT 'From login_master (Multiple id) (If event_type=3)',
  `created_date` datetime NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `modified_date` datetime NOT NULL,
  `modified_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0.Deactive, 1.Active(Default), 2. Archive'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `team_master`
--

CREATE TABLE `team_master` (
  `id` int(10) UNSIGNED NOT NULL,
  `team_name` varchar(255) NOT NULL,
  `team_page_link` varchar(255) NOT NULL COMMENT 'Unique slug (Used to share link with other)',
  `welcome_message` text NOT NULL,
  `team_logo` varchar(255) NOT NULL,
  `team_time_zone` varchar(255) NOT NULL,
  `created_date` datetime NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `modified_date` datetime NOT NULL,
  `modified_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0.Deactive, 1.Active(Default), 2. Archive'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `team_user_trans`
--

CREATE TABLE `team_user_trans` (
  `id` int(10) UNSIGNED NOT NULL,
  `team_id` int(10) UNSIGNED NOT NULL COMMENT 'From team_master',
  `login_id` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `created_date` datetime NOT NULL,
  `created_by` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `modified_date` datetime NOT NULL,
  `modified_by` int(10) UNSIGNED NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0.Deactive, 1.Active(Default), 2. Archive'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `user_work_time_master`
--

CREATE TABLE `user_work_time_master` (
  `id` int(10) UNSIGNED NOT NULL,
  `login_id` int(10) UNSIGNED NOT NULL COMMENT 'From login_master',
  `start_time` time NOT NULL,
  `end_time` time NOT NULL,
  `is_mon` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_tue` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_wed` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_thu` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_fri` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_sat` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `is_sun` tinyint(1) NOT NULL COMMENT '0.No, 1.Yes',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0.Deactive, 1.Active(Default), 2. Archive'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `calendar_event_master`
--
ALTER TABLE `calendar_event_master`
  ADD PRIMARY KEY (`id`),
  ADD KEY `event_type_id` (`event_type_id`),
  ADD KEY `login_id` (`login_id`),
  ADD KEY `calendar_connection_id` (`calendar_connection_id`),
  ADD KEY `created_by` (`created_by`),
  ADD KEY `team_id` (`team_id`);

--
-- Indexes for table `calendar_repeat_trans`
--
ALTER TABLE `calendar_repeat_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `calendar_event_id` (`calendar_event_id`),
  ADD KEY `event_completed_by` (`event_completed_by`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `ci_sessions`
--
ALTER TABLE `ci_sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `ci_sessions_timestamp` (`timestamp`);

--
-- Indexes for table `event_type_master`
--
ALTER TABLE `event_type_master`
  ADD PRIMARY KEY (`id`),
  ADD KEY `login_id` (`login_id`),
  ADD KEY `team_id` (`team_id`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `team_master`
--
ALTER TABLE `team_master`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `team_user_trans`
--
ALTER TABLE `team_user_trans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `team_id` (`team_id`),
  ADD KEY `login_id` (`login_id`),
  ADD KEY `created_by` (`created_by`);

--
-- Indexes for table `user_work_time_master`
--
ALTER TABLE `user_work_time_master`
  ADD PRIMARY KEY (`id`),
  ADD KEY `login_id` (`login_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `calendar_event_master`
--
ALTER TABLE `calendar_event_master`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `calendar_repeat_trans`
--
ALTER TABLE `calendar_repeat_trans`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `event_type_master`
--
ALTER TABLE `event_type_master`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `team_master`
--
ALTER TABLE `team_master`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `team_user_trans`
--
ALTER TABLE `team_user_trans`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `user_work_time_master`
--
ALTER TABLE `user_work_time_master`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

