-- +--------------------------------------------------------------------+
-- | Copyright CiviCRM LLC. All rights reserved.                        |
-- |                                                                    |
-- | This work is published under the GNU AGPLv3 license with some      |
-- | permitted exceptions and without any warranty. For full license    |
-- | and copyright information, see https://civicrm.org/licensing       |
-- +--------------------------------------------------------------------+
--
-- Generated from schema.tpl
-- DO NOT EDIT.  Generated by CRM_Core_CodeGen
--
-- /*******************************************************
-- *
-- * Clean up the existing tables - this section generated from drop.tpl
-- *
-- *******************************************************/



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

-- /*******************************************************
-- *
-- * civicrm_paymentprocessor_webhook
-- *
-- * Track the processing of payment processor webhooks
-- *
-- *******************************************************/
CREATE TABLE `civicrm_paymentprocessor_webhook` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique PaymentprocessorWebhook ID',
  `payment_processor_id` int unsigned COMMENT 'Payment Processor for this webhook',
  `event_id` varchar(255) COMMENT 'Webhook event ID',
  `trigger` varchar(255) COMMENT 'Webhook trigger event type',
  `created_date` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'When the webhook was first received by the IPN code',
  `processed_date` timestamp NULL DEFAULT NULL COMMENT 'Has this webhook been processed yet?',
  `status` varchar(32) NOT NULL DEFAULT "new" COMMENT 'Processing status',
  `identifier` varchar(255) COMMENT 'Optional key to group webhooks, as needed by some processors.',
  `message` varchar(1024) DEFAULT "" COMMENT 'Stores data sent that is needed for processing. JSON suggested.',
  `data` text COMMENT 'Stores data sent that is needed for processing. JSON suggested.',
  PRIMARY KEY (`id`),
  INDEX `index_event_id`(event_id),
  INDEX `index_created_date`(created_date),
  INDEX `index_processed_date`(processed_date),
  INDEX `index_status_processed_date`(status, processed_date),
  INDEX `index_identifier`(identifier),
  CONSTRAINT FK_civicrm_paymentprocessor_webhook_payment_processor_id FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor`(`id`) ON DELETE SET NULL
)
ENGINE=InnoDB;
