-- +--------------------------------------------------------------------+
-- | 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_form_processor_instance
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_instance` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(80) NOT NULL,
  `name` varchar(128) NULL,
  `is_active` tinyint NOT NULL,
  `description` text NULL,
  `output_handler` varchar(88) NOT NULL,
  `output_handler_configuration` text NULL,
  `enable_default_data` tinyint NOT NULL DEFAULT 0,
  `default_data_output_configuration` text NULL,
  `calculation_output_configuration` text NULL,
  `created_date` date NULL,
  `created_user_id` int unsigned COMMENT 'FK de contact',
  `modified_date` date NULL,
  `modified_user_id` int unsigned COMMENT 'FK de contact',
  `permission` varchar(255) NULL,
  `status` int unsigned NULL DEFAULT 1,
  `source_file` varchar(255) NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_instance_created_user_id FOREIGN KEY (`created_user_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL,
  CONSTRAINT FK_civicrm_form_processor_instance_modified_user_id FOREIGN KEY (`modified_user_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_validate_action
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_validate_action` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `title` varchar(128) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  `mapping` longtext NULL,
  `condition_configuration` longtext NULL,
  `delay` varchar(255) NULL,
  `delay_configuration` longtext NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_validate_action_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_validate_validator
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_validate_validator` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `title` varchar(128) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  `mapping` longtext NULL,
  `inputs` longtext NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_validate_validator_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_validation
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_validation` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorValidation ID',
  `entity` varchar(256) NULL,
  `entity_id` int unsigned NOT NULL,
  `validator` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  PRIMARY KEY (`id`))
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_action
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_action` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `title` varchar(128) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  `mapping` longtext NULL,
  `condition_configuration` longtext NULL,
  `delay` varchar(255) NULL,
  `delay_configuration` longtext NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_action_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_calculate_action
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_calculate_action` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `title` varchar(128) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  `mapping` longtext NULL,
  `condition_configuration` longtext NULL,
  `delay` varchar(255) NULL,
  `delay_configuration` longtext NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_calculate_action_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_default_data_action
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_default_data_action` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `title` varchar(128) NOT NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `configuration` longtext NULL,
  `mapping` longtext NULL,
  `condition_configuration` longtext NULL,
  `delay` varchar(255) NULL,
  `delay_configuration` longtext NULL,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_form_processor_default_data_action_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_default_data_input
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_default_data_input` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `include_formatted_params` tinyint NULL DEFAULT 1,
  `title` varchar(128) NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `is_required` tinyint NULL DEFAULT 0,
  `default_value` varchar(256) NULL,
  `configuration` longtext NULL,
  `parameter_mapping` longtext NULL,
  `default_data_parameter_mapping` longtext NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `name_id_UNIQUE`(form_processor_id, name),
  CONSTRAINT FK_civicrm_form_processor_default_data_input_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_form_processor_input
-- *
-- *******************************************************/
CREATE TABLE `civicrm_form_processor_input` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique FormProcessorInput ID',
  `form_processor_id` int unsigned NOT NULL COMMENT 'FK to Form Processor',
  `weight` int NOT NULL DEFAULT 0,
  `include_formatted_params` tinyint NULL DEFAULT 1,
  `title` varchar(128) NULL,
  `name` varchar(80) NOT NULL,
  `type` varchar(80) NOT NULL,
  `is_required` tinyint NULL DEFAULT 0,
  `default_value` varchar(256) NULL,
  `configuration` longtext NULL,
  `parameter_mapping` longtext NULL,
  `default_data_parameter_mapping` longtext NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `name_id_UNIQUE`(form_processor_id, name),
  CONSTRAINT FK_civicrm_form_processor_input_form_processor_id FOREIGN KEY (`form_processor_id`) REFERENCES `civicrm_form_processor_instance`(`id`) ON DELETE CASCADE)
ENGINE=InnoDB;
