View file File name : phpsch.sql Content : SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 utf8 */; -- -- Database: `booked285` -- -- -------------------------------------------------------- -- -- Table structure for table `accessories` -- CREATE TABLE `accessories` ( `accessory_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `accessory_name` varchar(85) NOT NULL, `accessory_quantity` smallint(5) unsigned DEFAULT NULL, `legacyid` char(16) DEFAULT NULL, PRIMARY KEY (`accessory_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; -- -- Dumping data for table `accessories` -- INSERT INTO `accessories` VALUES (1, 'accessory limited to 10', 10, NULL), (2, 'accessory limited to 2', 2, NULL), (3, 'unlimited accessory', NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `account_activation` -- CREATE TABLE `account_activation` ( `account_activation_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `activation_code` varchar(30) NOT NULL, `date_created` datetime NOT NULL, PRIMARY KEY (`account_activation_id`), UNIQUE KEY `activation_code_2` (`activation_code`), KEY `activation_code` (`activation_code`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `announcements` -- CREATE TABLE `announcements` ( `announcementid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `announcement_text` text NOT NULL, `priority` mediumint(8) DEFAULT NULL, `start_date` datetime DEFAULT NULL, `end_date` datetime DEFAULT NULL, `display_page` tinyint(1) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`announcementid`), KEY `start_date` (`start_date`), KEY `end_date` (`end_date`), KEY `display_page` (`display_page`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `announcement_groups` -- CREATE TABLE `announcement_groups` ( `announcementid` mediumint(8) unsigned NOT NULL, `group_id` smallint(5) unsigned NOT NULL, PRIMARY KEY (`announcementid`,`group_id`), KEY `group_id` (`group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `announcement_resources` -- CREATE TABLE `announcement_resources` ( `announcementid` mediumint(8) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, PRIMARY KEY (`announcementid`,`resource_id`), KEY `resource_id` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `blackout_instances` -- CREATE TABLE `blackout_instances` ( `blackout_instance_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `start_date` datetime NOT NULL, `end_date` datetime NOT NULL, `blackout_series_id` int(10) unsigned NOT NULL, PRIMARY KEY (`blackout_instance_id`), KEY `start_date` (`start_date`), KEY `end_date` (`end_date`), KEY `blackout_series_id` (`blackout_series_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `blackout_series` -- CREATE TABLE `blackout_series` ( `blackout_series_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date_created` datetime NOT NULL, `last_modified` datetime DEFAULT NULL, `title` varchar(85) NOT NULL, `description` text, `owner_id` mediumint(8) unsigned NOT NULL, `legacyid` char(16) DEFAULT NULL, `repeat_type` varchar(10) DEFAULT NULL, `repeat_options` varchar(255) DEFAULT NULL, PRIMARY KEY (`blackout_series_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `blackout_series_resources` -- CREATE TABLE `blackout_series_resources` ( `blackout_series_id` int(10) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, PRIMARY KEY (`blackout_series_id`,`resource_id`), KEY `resource_id` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `credit_log` -- CREATE TABLE `credit_log` ( `credit_log_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `original_credit_count` decimal(7,2) DEFAULT NULL, `credit_count` decimal(7,2) DEFAULT NULL, `credit_note` varchar(1000) DEFAULT NULL, `date_created` datetime NOT NULL, PRIMARY KEY (`credit_log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `custom_attributes` -- CREATE TABLE `custom_attributes` ( `custom_attribute_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `display_label` varchar(50) NOT NULL, `display_type` tinyint(2) unsigned NOT NULL, `attribute_category` tinyint(2) unsigned NOT NULL, `validation_regex` varchar(50) DEFAULT NULL, `is_required` tinyint(1) unsigned NOT NULL, `possible_values` text, `sort_order` tinyint(2) unsigned DEFAULT NULL, `admin_only` tinyint(1) unsigned DEFAULT NULL, `secondary_category` tinyint(2) unsigned DEFAULT NULL, `secondary_entity_ids` varchar(2000) DEFAULT NULL, `is_private` tinyint(1) unsigned DEFAULT NULL, PRIMARY KEY (`custom_attribute_id`), KEY `attribute_category` (`attribute_category`), KEY `display_label` (`display_label`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Dumping data for table `custom_attributes` -- INSERT INTO `custom_attributes` VALUES (1, 'Test Number', 1, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL), (2, 'Test String', 1, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL), (3, 'Test Number', 1, 4, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL), (4, 'Test String', 1, 4, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `custom_attribute_entities` -- CREATE TABLE `custom_attribute_entities` ( `custom_attribute_id` mediumint(8) unsigned NOT NULL, `entity_id` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`custom_attribute_id`,`entity_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `custom_attribute_values` -- CREATE TABLE `custom_attribute_values` ( `custom_attribute_value_id` int(8) unsigned NOT NULL AUTO_INCREMENT, `custom_attribute_id` mediumint(8) unsigned NOT NULL, `attribute_value` text NOT NULL, `entity_id` mediumint(8) unsigned NOT NULL, `attribute_category` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`custom_attribute_value_id`), KEY `custom_attribute_id` (`custom_attribute_id`), KEY `entity_id` (`entity_id`), KEY `attribute_category` (`attribute_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `custom_time_blocks` -- CREATE TABLE `custom_time_blocks` ( `custom_time_block_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `start_time` datetime NOT NULL, `end_time` datetime NOT NULL, `layout_id` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`custom_time_block_id`), KEY `layout_id` (`layout_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `dbversion` -- CREATE TABLE `dbversion` ( `version_number` double unsigned NOT NULL DEFAULT '0', `version_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `dbversion` -- INSERT INTO `dbversion` VALUES (2.1, '[[regtime]]'), (2.2, '[[regtime]]'), (2.3, '[[regtime]]'), (2.4, '[[regtime]]'), (2.5, '[[regtime]]'), (2.6, '[[regtime]]'), (2.7, '[[regtime]]'), (2.8, '[[regtime]]'); -- -------------------------------------------------------- -- -- Table structure for table `groups` -- CREATE TABLE `groups` ( `group_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(85) NOT NULL, `admin_group_id` smallint(5) unsigned DEFAULT NULL, `legacyid` char(16) DEFAULT NULL, `isdefault` tinyint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`group_id`), KEY `admin_group_id` (`admin_group_id`), KEY `isdefault` (`isdefault`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Dumping data for table `groups` -- INSERT INTO `groups` VALUES (1, 'Group Administrators', NULL, NULL, 0), (2, 'Application Administrators', NULL, NULL, 0), (3, 'Resource Administrators', NULL, NULL, 0), (4, 'Schedule Administrators', NULL, NULL, 0); -- -------------------------------------------------------- -- -- Table structure for table `group_resource_permissions` -- CREATE TABLE `group_resource_permissions` ( `group_id` smallint(5) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, `permission_type` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`group_id`,`resource_id`), KEY `group_id` (`group_id`), KEY `resource_id` (`resource_id`), KEY `group_id_2` (`group_id`), KEY `resource_id_2` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `group_roles` -- CREATE TABLE `group_roles` ( `group_id` smallint(8) unsigned NOT NULL, `role_id` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`group_id`,`role_id`), KEY `group_id` (`group_id`), KEY `role_id` (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `group_roles` -- INSERT INTO `group_roles` VALUES (1, 1), (2, 2), (4, 4); -- -------------------------------------------------------- -- -- Table structure for table `layouts` -- CREATE TABLE `layouts` ( `layout_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `timezone` varchar(50) NOT NULL, `layout_type` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`layout_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Dumping data for table `layouts` -- INSERT INTO `layouts` VALUES (1, 'America/New_York', 0); -- -------------------------------------------------------- -- -- Table structure for table `payment_configuration` -- CREATE TABLE `payment_configuration` ( `payment_configuration_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `credit_cost` decimal(7,2) unsigned NOT NULL, `credit_currency` varchar(10) NOT NULL, PRIMARY KEY (`payment_configuration_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Dumping data for table `payment_configuration` -- INSERT INTO `payment_configuration` VALUES (1, '0.00', 'USD'); -- -------------------------------------------------------- -- -- Table structure for table `payment_gateway_settings` -- CREATE TABLE `payment_gateway_settings` ( `gateway_type` varchar(255) NOT NULL, `setting_name` varchar(255) NOT NULL, `setting_value` varchar(1000) NOT NULL, PRIMARY KEY (`gateway_type`,`setting_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `payment_transaction_log` -- CREATE TABLE `payment_transaction_log` ( `payment_transaction_log_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `status` varchar(255) NOT NULL, `invoice_number` varchar(50) DEFAULT NULL, `transaction_id` varchar(50) NOT NULL, `subtotal_amount` decimal(7,2) NOT NULL, `tax_amount` decimal(7,2) NOT NULL, `total_amount` decimal(7,2) NOT NULL, `transaction_fee` decimal(7,2) DEFAULT NULL, `currency` varchar(3) NOT NULL, `transaction_href` varchar(500) DEFAULT NULL, `refund_href` varchar(500) DEFAULT NULL, `date_created` datetime NOT NULL, `gateway_name` varchar(100) NOT NULL, `gateway_date_created` varchar(25) NOT NULL, `payment_response` text, PRIMARY KEY (`payment_transaction_log_id`), KEY `user_id` (`user_id`), KEY `invoice_number` (`invoice_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `peak_times` -- CREATE TABLE `peak_times` ( `peak_times_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `schedule_id` smallint(5) unsigned NOT NULL, `all_day` tinyint(1) unsigned NOT NULL, `start_time` varchar(10) DEFAULT NULL, `end_time` varchar(10) DEFAULT NULL, `every_day` tinyint(1) unsigned NOT NULL, `peak_days` varchar(13) DEFAULT NULL, `all_year` tinyint(1) unsigned NOT NULL, `begin_month` tinyint(1) unsigned NOT NULL, `begin_day` tinyint(1) unsigned NOT NULL, `end_month` tinyint(1) unsigned NOT NULL, `end_day` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`peak_times_id`), KEY `schedule_id` (`schedule_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `quotas` -- CREATE TABLE `quotas` ( `quota_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `quota_limit` decimal(7,2) unsigned NOT NULL, `unit` varchar(25) NOT NULL, `duration` varchar(25) NOT NULL, `resource_id` smallint(5) unsigned DEFAULT NULL, `group_id` smallint(5) unsigned DEFAULT NULL, `schedule_id` smallint(5) unsigned DEFAULT NULL, `enforced_days` varchar(15) DEFAULT NULL, `enforced_time_start` time DEFAULT NULL, `enforced_time_end` time DEFAULT NULL, `scope` varchar(25) DEFAULT NULL, PRIMARY KEY (`quota_id`), KEY `resource_id` (`resource_id`), KEY `group_id` (`group_id`), KEY `schedule_id` (`schedule_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `refund_transaction_log` -- CREATE TABLE `refund_transaction_log` ( `refund_transaction_log_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `payment_transaction_log_id` int(10) unsigned NOT NULL, `status` varchar(255) NOT NULL, `transaction_id` varchar(50) DEFAULT NULL, `total_refund_amount` decimal(7,2) NOT NULL, `payment_refund_amount` decimal(7,2) DEFAULT NULL, `fee_refund_amount` decimal(7,2) DEFAULT NULL, `transaction_href` varchar(500) DEFAULT NULL, `date_created` datetime NOT NULL, `gateway_date_created` varchar(25) NOT NULL, `refund_response` text, PRIMARY KEY (`refund_transaction_log_id`), KEY `payment_transaction_log_id` (`payment_transaction_log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reminders` -- CREATE TABLE `reminders` ( `reminder_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `address` text NOT NULL, `message` text NOT NULL, `sendtime` datetime NOT NULL, `refnumber` text NOT NULL, PRIMARY KEY (`reminder_id`), KEY `reminders_user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_accessories` -- CREATE TABLE `reservation_accessories` ( `series_id` int(10) unsigned NOT NULL, `accessory_id` smallint(5) unsigned NOT NULL, `quantity` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (`series_id`,`accessory_id`), KEY `accessory_id` (`accessory_id`), KEY `series_id` (`series_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `reservation_color_rules` -- CREATE TABLE `reservation_color_rules` ( `reservation_color_rule_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `custom_attribute_id` mediumint(8) unsigned NOT NULL, `attribute_type` smallint(5) unsigned DEFAULT NULL, `required_value` text, `comparison_type` smallint(5) unsigned DEFAULT NULL, `color` varchar(50) DEFAULT NULL, PRIMARY KEY (`reservation_color_rule_id`), KEY `custom_attribute_id` (`custom_attribute_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_files` -- CREATE TABLE `reservation_files` ( `file_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `series_id` int(10) unsigned NOT NULL, `file_name` varchar(250) NOT NULL, `file_type` varchar(75) DEFAULT NULL, `file_size` varchar(45) NOT NULL, `file_extension` varchar(10) NOT NULL, PRIMARY KEY (`file_id`), KEY `series_id` (`series_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_guests` -- CREATE TABLE `reservation_guests` ( `reservation_instance_id` int(10) unsigned NOT NULL, `email` varchar(255) NOT NULL, `reservation_user_level` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`reservation_instance_id`,`email`), KEY `reservation_guests_reservation_instance_id` (`reservation_instance_id`), KEY `reservation_guests_email_address` (`email`), KEY `reservation_guests_reservation_user_level` (`reservation_user_level`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `reservation_instances` -- CREATE TABLE `reservation_instances` ( `reservation_instance_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `start_date` datetime NOT NULL, `end_date` datetime NOT NULL, `reference_number` varchar(50) NOT NULL, `series_id` int(10) unsigned NOT NULL, `checkin_date` datetime DEFAULT NULL, `checkout_date` datetime DEFAULT NULL, `previous_end_date` datetime DEFAULT NULL, `credit_count` decimal(7,2) unsigned DEFAULT NULL, PRIMARY KEY (`reservation_instance_id`), KEY `start_date` (`start_date`), KEY `end_date` (`end_date`), KEY `reference_number` (`reference_number`), KEY `series_id` (`series_id`), KEY `checkin_date` (`checkin_date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_reminders` -- CREATE TABLE `reservation_reminders` ( `reminder_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `series_id` int(10) unsigned NOT NULL, `minutes_prior` int(10) unsigned NOT NULL, `reminder_type` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`reminder_id`), KEY `series_id` (`series_id`), KEY `reminder_type` (`reminder_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_resources` -- CREATE TABLE `reservation_resources` ( `series_id` int(10) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, `resource_level_id` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`series_id`,`resource_id`), KEY `resource_id` (`resource_id`), KEY `series_id` (`series_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `reservation_series` -- CREATE TABLE `reservation_series` ( `series_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date_created` datetime NOT NULL, `last_modified` datetime DEFAULT NULL, `title` varchar(300) DEFAULT NULL, `description` text, `allow_participation` tinyint(1) unsigned NOT NULL, `allow_anon_participation` tinyint(1) unsigned NOT NULL, `type_id` tinyint(2) unsigned NOT NULL, `status_id` tinyint(2) unsigned NOT NULL, `repeat_type` varchar(10) DEFAULT NULL, `repeat_options` varchar(255) DEFAULT NULL, `owner_id` mediumint(8) unsigned NOT NULL, `legacyid` char(16) DEFAULT NULL, `last_action_by` mediumint(8) unsigned DEFAULT NULL, `terms_date_accepted` datetime DEFAULT NULL, PRIMARY KEY (`series_id`), KEY `type_id` (`type_id`), KEY `status_id` (`status_id`), KEY `reservations_owner` (`owner_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `reservation_statuses` -- CREATE TABLE `reservation_statuses` ( `status_id` tinyint(2) unsigned NOT NULL, `label` varchar(85) NOT NULL, PRIMARY KEY (`status_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `reservation_statuses` -- INSERT INTO `reservation_statuses` VALUES (1, 'Created'), (2, 'Deleted'), (3, 'Pending'); -- -------------------------------------------------------- -- -- Table structure for table `reservation_types` -- CREATE TABLE `reservation_types` ( `type_id` tinyint(2) unsigned NOT NULL, `label` varchar(85) NOT NULL, PRIMARY KEY (`type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `reservation_types` -- INSERT INTO `reservation_types` VALUES (1, 'Reservation'), (2, 'Blackout'); -- -------------------------------------------------------- -- -- Table structure for table `reservation_users` -- CREATE TABLE `reservation_users` ( `reservation_instance_id` int(10) unsigned NOT NULL, `user_id` mediumint(8) unsigned NOT NULL, `reservation_user_level` tinyint(2) unsigned NOT NULL, PRIMARY KEY (`reservation_instance_id`,`user_id`), KEY `reservation_instance_id` (`reservation_instance_id`), KEY `user_id` (`user_id`), KEY `reservation_user_level` (`reservation_user_level`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `reservation_waitlist_requests` -- CREATE TABLE `reservation_waitlist_requests` ( `reservation_waitlist_request_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, `start_date` datetime DEFAULT NULL, `end_date` datetime DEFAULT NULL, PRIMARY KEY (`reservation_waitlist_request_id`), KEY `user_id` (`user_id`), KEY `resource_id` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resources` -- CREATE TABLE `resources` ( `resource_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(85) NOT NULL, `location` varchar(255) DEFAULT NULL, `contact_info` varchar(255) DEFAULT NULL, `description` text, `notes` text, `min_duration` int(11) DEFAULT NULL, `min_increment` int(11) DEFAULT NULL, `max_duration` int(11) DEFAULT NULL, `unit_cost` decimal(7,2) DEFAULT NULL, `autoassign` tinyint(1) unsigned NOT NULL DEFAULT '1', `requires_approval` tinyint(1) unsigned NOT NULL, `allow_multiday_reservations` tinyint(1) unsigned NOT NULL DEFAULT '1', `max_participants` mediumint(8) unsigned DEFAULT NULL, `min_notice_time_add` int(11) DEFAULT NULL, `max_notice_time` int(11) DEFAULT NULL, `image_name` varchar(50) DEFAULT NULL, `schedule_id` smallint(5) unsigned NOT NULL, `legacyid` char(16) DEFAULT NULL, `admin_group_id` smallint(5) unsigned DEFAULT NULL, `public_id` varchar(20) DEFAULT NULL, `allow_calendar_subscription` tinyint(1) NOT NULL DEFAULT '0', `sort_order` smallint(5) unsigned DEFAULT NULL, `resource_type_id` mediumint(8) unsigned DEFAULT NULL, `status_id` tinyint(3) unsigned NOT NULL DEFAULT '1', `resource_status_reason_id` smallint(5) unsigned DEFAULT NULL, `buffer_time` int(10) unsigned DEFAULT NULL, `enable_check_in` tinyint(1) unsigned NOT NULL DEFAULT '0', `auto_release_minutes` smallint(5) unsigned DEFAULT NULL, `color` varchar(10) DEFAULT NULL, `allow_display` tinyint(1) unsigned NOT NULL DEFAULT '0', `credit_count` decimal(7,2) unsigned DEFAULT NULL, `peak_credit_count` decimal(7,2) unsigned DEFAULT NULL, `min_notice_time_update` int(11) DEFAULT NULL, `min_notice_time_delete` int(11) DEFAULT NULL, `date_created` datetime DEFAULT NULL, `last_modified` datetime DEFAULT NULL, `additional_properties` text, PRIMARY KEY (`resource_id`), UNIQUE KEY `public_id` (`public_id`), KEY `schedule_id` (`schedule_id`), KEY `admin_group_id` (`admin_group_id`), KEY `resource_type_id` (`resource_type_id`), KEY `resource_status_reason_id` (`resource_status_reason_id`), KEY `auto_release_minutes` (`auto_release_minutes`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -- Dumping data for table `resources` -- INSERT INTO `resources` VALUES (1, 'Conference Room 1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, NULL, NULL, NULL, 'resource1.jpg', 1, NULL, NULL, NULL, 0, NULL, NULL, 1, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (2, 'Conference Room 2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, NULL, NULL, NULL, 'resource2.jpg', 1, NULL, NULL, NULL, 0, NULL, NULL, 1, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Table structure for table `resource_accessories` -- CREATE TABLE `resource_accessories` ( `resource_accessory_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `resource_id` smallint(5) unsigned NOT NULL, `accessory_id` smallint(5) unsigned NOT NULL, `minimum_quantity` smallint(6) DEFAULT NULL, `maximum_quantity` smallint(6) DEFAULT NULL, PRIMARY KEY (`resource_accessory_id`), KEY `resource_id` (`resource_id`), KEY `accessory_id` (`accessory_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resource_groups` -- CREATE TABLE `resource_groups` ( `resource_group_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `resource_group_name` varchar(75) DEFAULT NULL, `parent_id` mediumint(8) unsigned DEFAULT NULL, `public_id` varchar(20) DEFAULT NULL, PRIMARY KEY (`resource_group_id`), KEY `resource_groups_parent_id` (`parent_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resource_group_assignment` -- CREATE TABLE `resource_group_assignment` ( `resource_group_id` mediumint(8) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, PRIMARY KEY (`resource_group_id`,`resource_id`), KEY `resource_group_assignment_resource_id` (`resource_id`), KEY `resource_group_assignment_resource_group_id` (`resource_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `resource_images` -- CREATE TABLE `resource_images` ( `resource_image_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `resource_id` smallint(5) unsigned NOT NULL, `image_name` varchar(50) DEFAULT NULL, PRIMARY KEY (`resource_image_id`), KEY `resource_id` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resource_status_reasons` -- CREATE TABLE `resource_status_reasons` ( `resource_status_reason_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `status_id` tinyint(3) unsigned NOT NULL, `description` varchar(100) DEFAULT NULL, PRIMARY KEY (`resource_status_reason_id`), KEY `status_id` (`status_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resource_types` -- CREATE TABLE `resource_types` ( `resource_type_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `resource_type_name` varchar(75) DEFAULT NULL, `resource_type_description` text, PRIMARY KEY (`resource_type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `resource_type_assignment` -- CREATE TABLE `resource_type_assignment` ( `resource_id` smallint(5) unsigned NOT NULL, `resource_type_id` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`resource_id`,`resource_type_id`), KEY `resource_type_id` (`resource_type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Table structure for table `roles` -- CREATE TABLE `roles` ( `role_id` tinyint(2) unsigned NOT NULL, `name` varchar(85) DEFAULT NULL, `role_level` tinyint(2) unsigned DEFAULT NULL, PRIMARY KEY (`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `roles` -- INSERT INTO `roles` VALUES (1, 'Group Admin', 1), (2, 'Application Admin', 2), (3, 'Resource Admin', 3), (4, 'Schedule Admin', 4); -- -------------------------------------------------------- -- -- Table structure for table `saved_reports` -- CREATE TABLE `saved_reports` ( `saved_report_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `report_name` varchar(50) DEFAULT NULL, `user_id` mediumint(8) unsigned NOT NULL, `date_created` datetime NOT NULL, `report_details` varchar(500) NOT NULL, PRIMARY KEY (`saved_report_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `schedules` -- CREATE TABLE `schedules` ( `schedule_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(85) NOT NULL, `isdefault` tinyint(1) unsigned NOT NULL, `weekdaystart` tinyint(2) unsigned NOT NULL, `daysvisible` tinyint(2) unsigned NOT NULL DEFAULT '7', `layout_id` mediumint(8) unsigned NOT NULL, `legacyid` char(16) DEFAULT NULL, `public_id` varchar(20) DEFAULT NULL, `allow_calendar_subscription` tinyint(1) NOT NULL DEFAULT '0', `admin_group_id` smallint(5) unsigned DEFAULT NULL, `start_date` datetime DEFAULT NULL, `end_date` datetime DEFAULT NULL, `allow_concurrent_bookings` tinyint(1) unsigned NOT NULL DEFAULT '0', `default_layout` tinyint(4) NOT NULL DEFAULT '0', `total_concurrent_reservations` smallint(5) unsigned NOT NULL DEFAULT '0', `max_resources_per_reservation` smallint(5) unsigned NOT NULL DEFAULT '0', `additional_properties` text, PRIMARY KEY (`schedule_id`), UNIQUE KEY `public_id` (`public_id`), KEY `layout_id` (`layout_id`), KEY `schedules_groups_admin_group_id` (`admin_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- -- Dumping data for table `schedules` -- INSERT INTO `schedules` VALUES (1, 'Default', 1, 0, 7, 1, NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, NULL); -- -------------------------------------------------------- -- -- Table structure for table `terms_of_service` -- CREATE TABLE `terms_of_service` ( `terms_of_service_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `terms_text` text, `terms_url` varchar(255) DEFAULT NULL, `terms_file` varchar(50) DEFAULT NULL, `applicability` varchar(50) DEFAULT NULL, `date_created` datetime NOT NULL, PRIMARY KEY (`terms_of_service_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `time_blocks` -- CREATE TABLE `time_blocks` ( `block_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `label` varchar(85) DEFAULT NULL, `end_label` varchar(85) DEFAULT NULL, `availability_code` tinyint(2) unsigned NOT NULL, `layout_id` mediumint(8) unsigned NOT NULL, `start_time` time NOT NULL, `end_time` time NOT NULL, `day_of_week` smallint(5) unsigned DEFAULT NULL, PRIMARY KEY (`block_id`), KEY `layout_id` (`layout_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ; -- -- Dumping data for table `time_blocks` -- INSERT INTO `time_blocks` VALUES (1, NULL, NULL, 2, 1, '00:00:00', '08:00:00', NULL), (2, NULL, NULL, 1, 1, '08:00:00', '08:30:00', NULL), (3, NULL, NULL, 1, 1, '08:30:00', '09:00:00', NULL), (4, NULL, NULL, 1, 1, '09:00:00', '09:30:00', NULL), (5, NULL, NULL, 1, 1, '09:30:00', '10:00:00', NULL), (6, NULL, NULL, 1, 1, '10:00:00', '10:30:00', NULL), (7, NULL, NULL, 1, 1, '10:30:00', '11:00:00', NULL), (8, NULL, NULL, 1, 1, '11:00:00', '11:30:00', NULL), (9, NULL, NULL, 1, 1, '11:30:00', '12:00:00', NULL), (10, NULL, NULL, 1, 1, '12:00:00', '12:30:00', NULL), (11, NULL, NULL, 1, 1, '12:30:00', '13:00:00', NULL), (12, NULL, NULL, 1, 1, '13:00:00', '13:30:00', NULL), (13, NULL, NULL, 1, 1, '13:30:00', '14:00:00', NULL), (14, NULL, NULL, 1, 1, '14:00:00', '14:30:00', NULL), (15, NULL, NULL, 1, 1, '14:30:00', '15:00:00', NULL), (16, NULL, NULL, 1, 1, '15:00:00', '15:30:00', NULL), (17, NULL, NULL, 1, 1, '15:30:00', '16:00:00', NULL), (18, NULL, NULL, 1, 1, '16:00:00', '16:30:00', NULL), (19, NULL, NULL, 1, 1, '16:30:00', '17:00:00', NULL), (20, NULL, NULL, 1, 1, '17:00:00', '17:30:00', NULL), (21, NULL, NULL, 1, 1, '17:30:00', '18:00:00', NULL), (22, NULL, NULL, 2, 1, '18:00:00', '00:00:00', NULL); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `user_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `fname` varchar(85) DEFAULT NULL, `lname` varchar(85) DEFAULT NULL, `username` varchar(85) DEFAULT NULL, `email` varchar(85) NOT NULL, `password` varchar(85) NOT NULL, `salt` varchar(85) NOT NULL, `organization` varchar(85) DEFAULT NULL, `position` varchar(85) DEFAULT NULL, `phone` varchar(85) DEFAULT NULL, `timezone` varchar(85) NOT NULL, `language` varchar(10) NOT NULL, `homepageid` tinyint(2) unsigned NOT NULL DEFAULT '1', `date_created` datetime NOT NULL, `last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `lastlogin` datetime DEFAULT NULL, `status_id` tinyint(2) unsigned NOT NULL, `legacyid` char(16) DEFAULT NULL, `legacypassword` varchar(32) DEFAULT NULL, `public_id` varchar(20) DEFAULT NULL, `allow_calendar_subscription` tinyint(1) NOT NULL DEFAULT '0', `default_schedule_id` smallint(5) unsigned DEFAULT NULL, `credit_count` decimal(7,2) DEFAULT '0.00', `terms_date_accepted` datetime DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `public_id` (`public_id`), KEY `status_id` (`status_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -- Dumping data for table `users` -- INSERT INTO `users` VALUES (1, 'User', 'User', 'user', 'user@example.com', '7b6aec38ff9b7650d64d0374194307bdde711425', '3b3dbb9b', 'XYZ Org Inc.', NULL, NULL, 'America/New_York', 'en_us', 1, '[[regtime]]', '[[regtime]]', '2008-09-16 01:59:00', 1, NULL, NULL, NULL, 0, NULL, '0.00', NULL), (2, '[[admin_fname]]', '[[admin_lname]]', '[[admin_username]]', '[[admin_email]]', '[[admin_pass]]', '[[salt]]', '[[site_name]]', NULL, NULL, 'America/New_York', 'en_us', 1, '[[regtime]]', '[[regtime]]', '2010-03-26 12:44:00', 1, NULL, NULL, NULL, 0, NULL, '0.00', NULL); -- -------------------------------------------------------- -- -- Table structure for table `user_email_preferences` -- CREATE TABLE `user_email_preferences` ( `user_id` mediumint(8) unsigned NOT NULL, `event_category` varchar(45) NOT NULL, `event_type` varchar(45) NOT NULL, PRIMARY KEY (`user_id`,`event_category`,`event_type`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `user_groups` -- CREATE TABLE `user_groups` ( `user_id` mediumint(8) unsigned NOT NULL, `group_id` smallint(5) unsigned NOT NULL, PRIMARY KEY (`group_id`,`user_id`), KEY `user_id` (`user_id`), KEY `group_id` (`group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `user_groups` -- INSERT INTO `user_groups` VALUES (2, 2); -- -------------------------------------------------------- -- -- Table structure for table `user_preferences` -- CREATE TABLE `user_preferences` ( `user_preferences_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `name` varchar(100) NOT NULL, `value` text, PRIMARY KEY (`user_preferences_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `user_resource_permissions` -- CREATE TABLE `user_resource_permissions` ( `user_id` mediumint(8) unsigned NOT NULL, `resource_id` smallint(5) unsigned NOT NULL, `permission_id` tinyint(2) unsigned NOT NULL DEFAULT '1', `permission_type` tinyint(3) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`user_id`,`resource_id`), KEY `user_id` (`user_id`), KEY `resource_id` (`resource_id`), KEY `user_id_2` (`user_id`), KEY `resource_id_2` (`resource_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `user_resource_permissions` -- INSERT INTO `user_resource_permissions` VALUES (1, 1, 1, 0), (1, 2, 1, 0), (2, 1, 1, 0), (2, 2, 1, 0); -- -------------------------------------------------------- -- -- Table structure for table `user_session` -- CREATE TABLE `user_session` ( `user_session_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `last_modified` datetime NOT NULL, `session_token` varchar(50) NOT NULL, `user_session_value` text NOT NULL, PRIMARY KEY (`user_session_id`), KEY `user_session_user_id` (`user_id`), KEY `user_session_session_token` (`session_token`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- -- -- Table structure for table `user_statuses` -- CREATE TABLE `user_statuses` ( `status_id` tinyint(2) unsigned NOT NULL, `description` varchar(85) DEFAULT NULL, PRIMARY KEY (`status_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `user_statuses` -- INSERT INTO `user_statuses` VALUES (1, 'Active'), (2, 'Awaiting'), (3, 'Inactive'); -- -- Constraints for dumped tables -- -- -- Constraints for table `account_activation` -- ALTER TABLE `account_activation` ADD CONSTRAINT `account_activation_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE; -- -- Constraints for table `announcement_groups` -- ALTER TABLE `announcement_groups` ADD CONSTRAINT `announcement_groups_ibfk_1` FOREIGN KEY (`announcementid`) REFERENCES `announcements` (`announcementid`) ON DELETE CASCADE, ADD CONSTRAINT `announcement_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE; -- -- Constraints for table `announcement_resources` -- ALTER TABLE `announcement_resources` ADD CONSTRAINT `announcement_resources_ibfk_1` FOREIGN KEY (`announcementid`) REFERENCES `announcements` (`announcementid`) ON DELETE CASCADE, ADD CONSTRAINT `announcement_resources_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE; -- -- Constraints for table `blackout_instances` -- ALTER TABLE `blackout_instances` ADD CONSTRAINT `blackout_instances_ibfk_1` FOREIGN KEY (`blackout_series_id`) REFERENCES `blackout_series` (`blackout_series_id`) ON DELETE CASCADE; -- -- Constraints for table `blackout_series_resources` -- ALTER TABLE `blackout_series_resources` ADD CONSTRAINT `blackout_series_resources_ibfk_1` FOREIGN KEY (`blackout_series_id`) REFERENCES `blackout_series` (`blackout_series_id`) ON DELETE CASCADE, ADD CONSTRAINT `blackout_series_resources_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE; -- -- Constraints for table `custom_attribute_entities` -- ALTER TABLE `custom_attribute_entities` ADD CONSTRAINT `custom_attribute_entities_ibfk_1` FOREIGN KEY (`custom_attribute_id`) REFERENCES `custom_attributes` (`custom_attribute_id`) ON DELETE CASCADE; -- -- Constraints for table `custom_time_blocks` -- ALTER TABLE `custom_time_blocks` ADD CONSTRAINT `custom_time_blocks_ibfk_1` FOREIGN KEY (`layout_id`) REFERENCES `layouts` (`layout_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `groups` -- ALTER TABLE `groups` ADD CONSTRAINT `groups_ibfk_1` FOREIGN KEY (`admin_group_id`) REFERENCES `groups` (`group_id`); -- -- Constraints for table `group_resource_permissions` -- ALTER TABLE `group_resource_permissions` ADD CONSTRAINT `group_resource_permissions_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `group_resource_permissions_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `group_roles` -- ALTER TABLE `group_roles` ADD CONSTRAINT `group_roles_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `group_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `peak_times` -- ALTER TABLE `peak_times` ADD CONSTRAINT `peak_times_ibfk_1` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`schedule_id`) ON DELETE CASCADE; -- -- Constraints for table `quotas` -- ALTER TABLE `quotas` ADD CONSTRAINT `quotas_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `quotas_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `quotas_ibfk_3` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`schedule_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `refund_transaction_log` -- ALTER TABLE `refund_transaction_log` ADD CONSTRAINT `refund_transaction_log_ibfk_1` FOREIGN KEY (`payment_transaction_log_id`) REFERENCES `payment_transaction_log` (`payment_transaction_log_id`) ON DELETE CASCADE; -- -- Constraints for table `reminders` -- ALTER TABLE `reminders` ADD CONSTRAINT `reminders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE; -- -- Constraints for table `reservation_accessories` -- ALTER TABLE `reservation_accessories` ADD CONSTRAINT `reservation_accessories_ibfk_1` FOREIGN KEY (`accessory_id`) REFERENCES `accessories` (`accessory_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `reservation_accessories_ibfk_2` FOREIGN KEY (`series_id`) REFERENCES `reservation_series` (`series_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reservation_color_rules` -- ALTER TABLE `reservation_color_rules` ADD CONSTRAINT `reservation_color_rules_ibfk_1` FOREIGN KEY (`custom_attribute_id`) REFERENCES `custom_attributes` (`custom_attribute_id`) ON DELETE CASCADE; -- -- Constraints for table `reservation_files` -- ALTER TABLE `reservation_files` ADD CONSTRAINT `reservation_files_ibfk_1` FOREIGN KEY (`series_id`) REFERENCES `reservation_series` (`series_id`) ON DELETE CASCADE; -- -- Constraints for table `reservation_guests` -- ALTER TABLE `reservation_guests` ADD CONSTRAINT `reservation_guests_ibfk_1` FOREIGN KEY (`reservation_instance_id`) REFERENCES `reservation_instances` (`reservation_instance_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reservation_instances` -- ALTER TABLE `reservation_instances` ADD CONSTRAINT `reservations_series` FOREIGN KEY (`series_id`) REFERENCES `reservation_series` (`series_id`) ON DELETE CASCADE; -- -- Constraints for table `reservation_reminders` -- ALTER TABLE `reservation_reminders` ADD CONSTRAINT `reservation_reminders_ibfk_1` FOREIGN KEY (`series_id`) REFERENCES `reservation_series` (`series_id`) ON DELETE CASCADE; -- -- Constraints for table `reservation_resources` -- ALTER TABLE `reservation_resources` ADD CONSTRAINT `reservation_resources_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `reservation_resources_ibfk_2` FOREIGN KEY (`series_id`) REFERENCES `reservation_series` (`series_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reservation_series` -- ALTER TABLE `reservation_series` ADD CONSTRAINT `reservations_owner` FOREIGN KEY (`owner_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE, ADD CONSTRAINT `reservations_status` FOREIGN KEY (`status_id`) REFERENCES `reservation_statuses` (`status_id`) ON UPDATE CASCADE, ADD CONSTRAINT `reservations_type` FOREIGN KEY (`type_id`) REFERENCES `reservation_types` (`type_id`) ON UPDATE CASCADE; -- -- Constraints for table `reservation_users` -- ALTER TABLE `reservation_users` ADD CONSTRAINT `reservation_users_ibfk_1` FOREIGN KEY (`reservation_instance_id`) REFERENCES `reservation_instances` (`reservation_instance_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `reservation_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `reservation_waitlist_requests` -- ALTER TABLE `reservation_waitlist_requests` ADD CONSTRAINT `reservation_waitlist_requests_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE, ADD CONSTRAINT `reservation_waitlist_requests_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE; -- -- Constraints for table `resources` -- ALTER TABLE `resources` ADD CONSTRAINT `admin_group_id` FOREIGN KEY (`admin_group_id`) REFERENCES `groups` (`group_id`) ON DELETE SET NULL, ADD CONSTRAINT `resources_ibfk_1` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`schedule_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `resources_ibfk_2` FOREIGN KEY (`resource_type_id`) REFERENCES `resource_types` (`resource_type_id`) ON DELETE SET NULL, ADD CONSTRAINT `resources_ibfk_3` FOREIGN KEY (`resource_status_reason_id`) REFERENCES `resource_status_reasons` (`resource_status_reason_id`) ON DELETE SET NULL; -- -- Constraints for table `resource_accessories` -- ALTER TABLE `resource_accessories` ADD CONSTRAINT `resource_accessories_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE, ADD CONSTRAINT `resource_accessories_ibfk_2` FOREIGN KEY (`accessory_id`) REFERENCES `accessories` (`accessory_id`) ON DELETE CASCADE; -- -- Constraints for table `resource_groups` -- ALTER TABLE `resource_groups` ADD CONSTRAINT `resource_groups_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `resource_groups` (`resource_group_id`) ON DELETE CASCADE; -- -- Constraints for table `resource_group_assignment` -- ALTER TABLE `resource_group_assignment` ADD CONSTRAINT `resource_group_assignment_ibfk_1` FOREIGN KEY (`resource_group_id`) REFERENCES `resource_groups` (`resource_group_id`) ON DELETE CASCADE, ADD CONSTRAINT `resource_group_assignment_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE; -- -- Constraints for table `resource_images` -- ALTER TABLE `resource_images` ADD CONSTRAINT `resource_images_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `resource_type_assignment` -- ALTER TABLE `resource_type_assignment` ADD CONSTRAINT `resource_type_assignment_ibfk_1` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE, ADD CONSTRAINT `resource_type_assignment_ibfk_2` FOREIGN KEY (`resource_type_id`) REFERENCES `resource_types` (`resource_type_id`) ON DELETE CASCADE; -- -- Constraints for table `saved_reports` -- ALTER TABLE `saved_reports` ADD CONSTRAINT `saved_reports_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE; -- -- Constraints for table `schedules` -- ALTER TABLE `schedules` ADD CONSTRAINT `schedules_groups_admin_group_id` FOREIGN KEY (`admin_group_id`) REFERENCES `groups` (`group_id`) ON DELETE SET NULL, ADD CONSTRAINT `schedules_ibfk_1` FOREIGN KEY (`layout_id`) REFERENCES `layouts` (`layout_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `time_blocks` -- ALTER TABLE `time_blocks` ADD CONSTRAINT `time_blocks_ibfk_1` FOREIGN KEY (`layout_id`) REFERENCES `layouts` (`layout_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `users` -- ALTER TABLE `users` ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`status_id`) REFERENCES `user_statuses` (`status_id`) ON UPDATE CASCADE; -- -- Constraints for table `user_email_preferences` -- ALTER TABLE `user_email_preferences` ADD CONSTRAINT `user_email_preferences_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `user_groups` -- ALTER TABLE `user_groups` ADD CONSTRAINT `user_groups_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `user_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `user_preferences` -- ALTER TABLE `user_preferences` ADD CONSTRAINT `user_preferences_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `user_resource_permissions` -- ALTER TABLE `user_resource_permissions` ADD CONSTRAINT `user_resource_permissions_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `user_resource_permissions_ibfk_2` FOREIGN KEY (`resource_id`) REFERENCES `resources` (`resource_id`) ON DELETE CASCADE ON UPDATE CASCADE; -- -- Constraints for table `user_session` -- ALTER TABLE `user_session` ADD CONSTRAINT `user_session_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE; /*!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 */;