-- +--------------------------------------------------------------------+
-- | 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
-- 

-- +--------------------------------------------------------------------+
-- | 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 drop.tpl
-- DO NOT EDIT.  Generated by CRM_Core_CodeGen
--
-- /*******************************************************
-- *
-- * Clean up the existing tables
-- *
-- *******************************************************/



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

-- /*******************************************************
-- *
-- * civicrm_mosaico_msg_template
-- *
-- * Mosaico Templates Table
-- *
-- *******************************************************/
CREATE TABLE `civicrm_mosaico_msg_template` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique Settings ID',
     `msg_tpl_id` int unsigned NOT NULL   COMMENT 'FK to civicrm_msg_template.',
     `hash_key` varchar(32) NOT NULL   ,
     `name` varchar(32) NOT NULL   COMMENT 'name',
     `html` longtext NOT NULL   COMMENT 'HTML',
     `metadata` longtext NOT NULL   COMMENT 'metadata',
     `template` longtext NOT NULL   COMMENT 'template' 
,
        PRIMARY KEY (`id`)
 
 
,          CONSTRAINT FK_civicrm_mosaico_msg_template_msg_tpl_id FOREIGN KEY (`msg_tpl_id`) REFERENCES `civicrm_msg_template`(`id`) ON DELETE CASCADE  
) ENGINE=InnoDB    ;

-- /*******************************************************
-- *
-- * civicrm_mosaico_template
-- *
-- * Standalone Mosaico Template
-- *
-- *******************************************************/
CREATE TABLE `civicrm_mosaico_template` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique Template ID',
     `title` varchar(255)    COMMENT 'Title',
     `base` varchar(64)    COMMENT 'Name of the Mosaico base template (e.g. versafix-1)',
     `html` longtext    COMMENT 'Fully renderd HTML',
     `metadata` longtext    COMMENT 'Mosaico metadata (JSON)',
     `content` longtext    COMMENT 'Mosaico content (JSON)',
     `msg_tpl_id` int unsigned NULL   COMMENT 'FK to civicrm_msg_template.' 
,
        PRIMARY KEY (`id`)
 
 
,          CONSTRAINT FK_civicrm_mosaico_template_msg_tpl_id FOREIGN KEY (`msg_tpl_id`) REFERENCES `civicrm_msg_template`(`id`) ON DELETE SET NULL  
) ENGINE=InnoDB    ;

 
