-- +--------------------------------------------------------------------+
-- | 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_groupreg_event
-- *
-- * Stores per-event settings for groupreg extension
-- *
-- *******************************************************/
CREATE TABLE `civicrm_groupreg_event` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Uniq identifier',
  `event_id` int unsigned NOT NULL COMMENT 'FK to Event',
  `is_hide_not_you` tinyint NOT NULL DEFAULT 0,
  `related_contact_tag_id` int unsigned NULL DEFAULT NULL COMMENT 'FK to Tag',
  `is_prompt_related` int unsigned NOT NULL DEFAULT 0,
  `is_require_existing_contact` tinyint NOT NULL DEFAULT 0,
  `is_primary_attending` int unsigned NOT NULL DEFAULT 1,
  `nonattendee_role_id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Pseudo-FK to civicrm_option_value for participant_role',
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_groupreg_event_event_id FOREIGN KEY (`event_id`) REFERENCES `civicrm_event`(`id`) ON DELETE CASCADE,
  CONSTRAINT FK_civicrm_groupreg_event_related_contact_tag_id FOREIGN KEY (`related_contact_tag_id`) REFERENCES `civicrm_tag`(`id`) ON DELETE SET NULL
)
ENGINE=InnoDB;

-- /*******************************************************
-- *
-- * civicrm_groupreg_price_field
-- *
-- * Stores per-field settings for groupreg extension
-- *
-- *******************************************************/
CREATE TABLE `civicrm_groupreg_price_field` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique GroupregPriceField ID',
  `price_field_id` int unsigned NOT NULL COMMENT 'FK to Price Field',
  `is_hide_non_participant` tinyint NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  CONSTRAINT FK_civicrm_groupreg_price_field_price_field_id FOREIGN KEY (`price_field_id`) REFERENCES `civicrm_price_field`(`id`) ON DELETE CASCADE
)
ENGINE=InnoDB;
