-- +--------------------------------------------------------------------+
-- | CiviCRM version 5                                                  |
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC (c) 2004-2019                                |
-- +--------------------------------------------------------------------+
-- | This file is a part of CiviCRM.                                    |
-- |                                                                    |
-- | CiviCRM is free software; you can copy, modify, and distribute it  |
-- | under the terms of the GNU Affero General Public License           |
-- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
-- |                                                                    |
-- | CiviCRM is distributed in the hope that it will be useful, but     |
-- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
-- | See the GNU Affero General Public License for more details.        |
-- |                                                                    |
-- | You should have received a copy of the GNU Affero General Public   |
-- | License and the CiviCRM Licensing Exception along                  |
-- | with this program; if not, contact CiviCRM LLC                     |
-- | at info[AT]civicrm[DOT]org. If you have questions about the        |
-- | GNU Affero General Public License or the licensing of CiviCRM,     |
-- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
-- +--------------------------------------------------------------------+
--
-- Generated from schema.tpl
-- DO NOT EDIT.  Generated by CRM_Core_CodeGen
--


-- +--------------------------------------------------------------------+
-- | CiviCRM version 5                                                  |
-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC (c) 2004-2019                                |
-- +--------------------------------------------------------------------+
-- | This file is a part of CiviCRM.                                    |
-- |                                                                    |
-- | CiviCRM is free software; you can copy, modify, and distribute it  |
-- | under the terms of the GNU Affero General Public License           |
-- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
-- |                                                                    |
-- | CiviCRM is distributed in the hope that it will be useful, but     |
-- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
-- | See the GNU Affero General Public License for more details.        |
-- |                                                                    |
-- | You should have received a copy of the GNU Affero General Public   |
-- | License and the CiviCRM Licensing Exception along                  |
-- | with this program; if not, contact CiviCRM LLC                     |
-- | at info[AT]civicrm[DOT]org. If you have questions about the        |
-- | GNU Affero General Public License or the licensing of CiviCRM,     |
-- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
-- +--------------------------------------------------------------------+
--
-- Generated from drop.tpl
-- DO NOT EDIT.  Generated by CRM_Core_CodeGen
--
-- /*******************************************************
-- *
-- * Clean up the exisiting tables
-- *
-- *******************************************************/



-- /*******************************************************
-- *
-- * Create new tables
-- *
-- *******************************************************/

-- /*******************************************************
-- *
-- * civicrm_eventbrite_link
-- *
-- * Links between CiviCRM entities and Eventbrite entities
-- *
-- *******************************************************/
CREATE TABLE `civicrm_eventbrite_link` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique EventbriteLink ID',
     `civicrm_entity_type` varchar(255) NOT NULL   COMMENT 'Type of CiviCRM entity',
     `civicrm_entity_id` int unsigned NOT NULL   COMMENT 'ID of CiviCRM entity',
     `eb_entity_type` varchar(255) NOT NULL   COMMENT 'Type of Eventbrite entity',
     `eb_entity_id` varchar(255) NOT NULL   COMMENT 'ID of Eventbrite entity',
     `parent_id` int unsigned NULL   COMMENT 'FK to id'
,
        PRIMARY KEY (`id`)


,          CONSTRAINT FK_civicrm_eventbrite_link_parent_id FOREIGN KEY (`parent_id`) REFERENCES `civicrm_eventbrite_link`(`id`) ON DELETE CASCADE
)    ;

-- /*******************************************************
-- *
-- * civicrm_eventbrite_log
-- *
-- * Log messages for Eventbrite Integration
-- *
-- *******************************************************/
CREATE TABLE `civicrm_eventbrite_log` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique EventbriteLog ID',
     `created_date` timestamp NULL  DEFAULT CURRENT_TIMESTAMP COMMENT 'When was the log entry created.',
     `message_type_id` int unsigned NOT NULL   COMMENT 'Message type. See CRM_Eventbrite_BAO_EventbriteLog::MESSAGE_TYPE_ID_*',
     `message` text NOT NULL   COMMENT 'Logged message'
,
        PRIMARY KEY (`id`)



)    ;

-- /*******************************************************
-- *
-- * civicrm_eventbrite_queue
-- *
-- * Queued Eventbrite webhook events
-- *
-- *******************************************************/
CREATE TABLE `civicrm_eventbrite_queue` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique EventbriteQueue ID',
     `created_date` timestamp NULL  DEFAULT CURRENT_TIMESTAMP COMMENT 'When was the queue entry created.',
     `message` text    COMMENT 'Contents of the webhook event notification',
     `status_id` int unsigned NOT NULL  DEFAULT 1 COMMENT 'Status. See CRM_Eventbrite_BAO_EventbriteQueue::STATUS_ID_*'
,
        PRIMARY KEY (`id`)



)    ;


