Esempio n. 1
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            // Drop the AnalyticsDimFinancialTransactionType view to be consistent
            Sql(@"IF OBJECT_ID(N'[dbo].[AnalyticsDimFinancialTransactionType]', 'V') IS NOT NULL
    DROP VIEW [dbo].AnalyticsDimFinancialTransactionType
GO");
            // MP: Set 'Default' Communication Template IsActive=1
            Sql(@"UPDATE CommunicationTemplate
SET IsActive = 1
WHERE [Guid] = 'A3C7F623-7F6F-4C48-B66F-CBEE2DF30B6A';
");

            // MP: Update Group Member Attribute "Preferred Communication Type" to "Preferred Communication Medium"
            RockMigrationHelper.DeleteAttribute("D7941908-1F65-CC9B-416C-CCFABE4221B9");
            RockMigrationHelper.AddGroupTypeGroupMemberAttribute("D1D95777-FFA3-CBB3-4A6D-658706DAED33", SystemGuid.FieldType.COMMUNICATION_PREFERENCE_TYPE, "Preferred Communication Medium", "The preferred communication medium for this group member. Select None to use the person's default communication preference.", 0, "0", "D7941908-1F65-CC9B-416C-CCFABE4221B9");

            // MP: Update GroupList block for CommunicationList to have CustomGridColumns config
            // Attrib for BlockType: Group List:core.CustomGridColumnsConfig
            RockMigrationHelper.UpdateBlockTypeAttribute("3D7FB6BE-6BBD-49F7-96B4-96310AF3048A", "9C204CD0-1233-41C5-818A-C5DA439445AA", "core.CustomGridColumnsConfig", "core.CustomGridColumnsConfig", "", "", 0, @"", "487A898B-2192-459D-9546-32AE3EE9A9C5");
            // Attrib Value for Block:Group List, Attribute:core.CustomGridColumnsConfig Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "487A898B-2192-459D-9546-32AE3EE9A9C5", @"{
 ""ColumnsConfig"": [
 {
 ""HeaderText"": """",
 ""HeaderClass"": ""grid-columncommand"",
 ""ItemClass"": ""grid-columncommand"",
 ""LavaTemplate"": ""<div class='text-center'>\n <a href='~/EmailAnalytics?CommunicationListId={{Row.Id}}' class='btn btn-default btn-sm' title='Email Analytics'>\n <i class='fa fa-line-chart'></i>\n </a>\n</div>"",
 ""PositionOffsetType"": 1,
 ""PositionOffset"": 1
 }
 ]
}");

            // MP: Update Wizard Communication Block to use Block Settings and Approvers from existing block
            Sql(MigrationSQL._201710051632496_Analytics3_CommunicationBlockSettings);
        }
Esempio n. 2
0
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.UpdateFieldType("Data Views", "", "Rock", "Rock.Field.Types.DataViewsFieldType", "F739BF5D-3FDC-45EC-A03C-1AE7C47E3883");
            RockMigrationHelper.UpdateFieldType("Communication Preference", "", "Rock", "Rock.Field.Types.CommunicationPreferenceFieldType", "507C28F2-8BC0-4909-A4FE-9C2B1149E2B2");

            DropForeignKey("dbo.Communication", "MediumEntityTypeId", "dbo.EntityType");
            Sql(@"
IF object_id(N'[dbo].[FK_dbo.Communication_dbo.EntityType_ChannelEntityTypeId]', N'F') IS NOT NULL
    ALTER TABLE [dbo].[Communication] DROP CONSTRAINT [FK_dbo.Communication_dbo.EntityType_ChannelEntityTypeId]
");
            DropForeignKey("dbo.CommunicationTemplate", "MediumEntityTypeId", "dbo.EntityType");
            Sql(@"
IF object_id(N'[dbo].[FK_dbo.CommunicationTemplate_dbo.EntityType_ChannelEntityTypeId]', N'F') IS NOT NULL
    ALTER TABLE [dbo].[CommunicationTemplate] DROP CONSTRAINT [FK_dbo.CommunicationTemplate_dbo.EntityType_ChannelEntityTypeId]
");
            DropIndex("dbo.Communication", new[] { "MediumEntityTypeId" });
            DropIndex("dbo.CommunicationTemplate", new[] { "MediumEntityTypeId" });
            CreateTable(
                "dbo.CommunicationAttachment",
                c => new
            {
                Id                      = c.Int(nullable: false, identity: true),
                BinaryFileId            = c.Int(nullable: false),
                CommunicationId         = c.Int(nullable: false),
                CreatedDateTime         = c.DateTime(),
                ModifiedDateTime        = c.DateTime(),
                CreatedByPersonAliasId  = c.Int(),
                ModifiedByPersonAliasId = c.Int(),
                Guid                    = c.Guid(nullable: false),
                ForeignId               = c.Int(),
                ForeignGuid             = c.Guid(),
                ForeignKey              = c.String(maxLength: 100),
            })
            .PrimaryKey(t => t.Id)
            .ForeignKey("dbo.BinaryFile", t => t.BinaryFileId)
            .ForeignKey("dbo.Communication", t => t.CommunicationId, cascadeDelete: true)
            .ForeignKey("dbo.PersonAlias", t => t.CreatedByPersonAliasId)
            .ForeignKey("dbo.PersonAlias", t => t.ModifiedByPersonAliasId)
            .Index(t => t.BinaryFileId)
            .Index(t => t.CommunicationId)
            .Index(t => t.CreatedByPersonAliasId)
            .Index(t => t.ModifiedByPersonAliasId)
            .Index(t => t.Guid, unique: true);

            CreateTable(
                "dbo.CommunicationTemplateAttachment",
                c => new
            {
                Id                      = c.Int(nullable: false, identity: true),
                BinaryFileId            = c.Int(nullable: false),
                CommunicationTemplateId = c.Int(nullable: false),
                CreatedDateTime         = c.DateTime(),
                ModifiedDateTime        = c.DateTime(),
                CreatedByPersonAliasId  = c.Int(),
                ModifiedByPersonAliasId = c.Int(),
                Guid                    = c.Guid(nullable: false),
                ForeignId               = c.Int(),
                ForeignGuid             = c.Guid(),
                ForeignKey              = c.String(maxLength: 100),
            })
            .PrimaryKey(t => t.Id)
            .ForeignKey("dbo.BinaryFile", t => t.BinaryFileId)
            .ForeignKey("dbo.CommunicationTemplate", t => t.CommunicationTemplateId, cascadeDelete: true)
            .ForeignKey("dbo.PersonAlias", t => t.CreatedByPersonAliasId)
            .ForeignKey("dbo.PersonAlias", t => t.ModifiedByPersonAliasId)
            .Index(t => t.BinaryFileId)
            .Index(t => t.CommunicationTemplateId)
            .Index(t => t.CreatedByPersonAliasId)
            .Index(t => t.ModifiedByPersonAliasId)
            .Index(t => t.Guid, unique: true);

            AddColumn("dbo.Person", "CommunicationPreference", c => c.Int(nullable: false));
            AddColumn("dbo.CommunicationRecipient", "MediumEntityTypeId", c => c.Int());
            AddColumn("dbo.Communication", "Name", c => c.String(maxLength: 100));
            AddColumn("dbo.Communication", "CommunicationType", c => c.Int(nullable: false));
            AddColumn("dbo.Communication", "UrlReferrer", c => c.String(maxLength: 200));
            AddColumn("dbo.Communication", "ListGroupId", c => c.Int());
            AddColumn("dbo.Communication", "Segments", c => c.String());
            AddColumn("dbo.Communication", "SegmentCriteria", c => c.Int(nullable: false));
            AddColumn("dbo.Communication", "CommunicationTemplateId", c => c.Int());
            AddColumn("dbo.Communication", "FromName", c => c.String(maxLength: 100));
            AddColumn("dbo.Communication", "FromEmail", c => c.String(maxLength: 100));
            AddColumn("dbo.Communication", "ReplyToEmail", c => c.String(maxLength: 100));
            AddColumn("dbo.Communication", "CCEmails", c => c.String());
            AddColumn("dbo.Communication", "BCCEmails", c => c.String());
            AddColumn("dbo.Communication", "Message", c => c.String());
            AddColumn("dbo.Communication", "MessageMetaData", c => c.String());
            AddColumn("dbo.Communication", "SMSFromDefinedValueId", c => c.Int());
            AddColumn("dbo.Communication", "SMSMessage", c => c.String());
            AddColumn("dbo.Communication", "PushTitle", c => c.String(maxLength: 100));
            AddColumn("dbo.Communication", "PushMessage", c => c.String());
            AddColumn("dbo.Communication", "PushSound", c => c.String(maxLength: 100));
            AddColumn("dbo.CommunicationTemplate", "IsSystem", c => c.Boolean(nullable: false));
            AddColumn("dbo.CommunicationTemplate", "ImageFileId", c => c.Int());
            AddColumn("dbo.CommunicationTemplate", "FromName", c => c.String(maxLength: 100));
            AddColumn("dbo.CommunicationTemplate", "FromEmail", c => c.String(maxLength: 100));
            AddColumn("dbo.CommunicationTemplate", "ReplyToEmail", c => c.String(maxLength: 100));
            AddColumn("dbo.CommunicationTemplate", "CCEmails", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "BCCEmails", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "Message", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "MessageMetaData", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "SMSFromDefinedValueId", c => c.Int());
            AddColumn("dbo.CommunicationTemplate", "SMSMessage", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "PushTitle", c => c.String(maxLength: 100));
            AddColumn("dbo.CommunicationTemplate", "PushMessage", c => c.String());
            AddColumn("dbo.CommunicationTemplate", "PushSound", c => c.String(maxLength: 100));

            // Moved Index Creating to MigrateCommunicationMediumData job since it could take a while
            //CreateIndex("dbo.CommunicationRecipient", "MediumEntityTypeId");
            //CreateIndex("dbo.Communication", "CommunicationTemplateId");
            //CreateIndex("dbo.Communication", "SMSFromDefinedValueId");
            //CreateIndex("dbo.CommunicationTemplate", "SMSFromDefinedValueId");
            AddForeignKey("dbo.CommunicationTemplate", "SMSFromDefinedValueId", "dbo.DefinedValue", "Id");
            AddForeignKey("dbo.Communication", "SMSFromDefinedValueId", "dbo.DefinedValue", "Id");

            // Moved to MigrateCommunicationMediumData job since it could take a while
            //AddForeignKey("dbo.CommunicationRecipient", "MediumEntityTypeId", "dbo.EntityType", "Id");
            //AddForeignKey("dbo.Communication", "CommunicationTemplateId", "dbo.CommunicationTemplate", "Id");

            // Instead of AddForeignKey, do it manually so it can be a ON DELETE SET NULL
            Sql(@"ALTER TABLE dbo.Communication ADD CONSTRAINT [FK_dbo.Communication_dbo.CommunicationTemplate_CommunicationTemplateId] 
                    FOREIGN KEY (CommunicationTemplateId) REFERENCES dbo.CommunicationTemplate (Id) ON DELETE SET NULL");

            Sql(@"
    UPDATE C 
        SET [CommunicationType] = CASE E.[Name]
            WHEN 'Rock.Communication.Medium.Email' THEN 1
            WHEN 'Rock.Communication.Medium.Sms' THEN 2
            WHEN 'Rock.Communication.Medium.PushNotification' THEN 3
            WHEN 'com.bricksandmortarstudio.Communication.Medium.AlphanumericSMS' THEN 2
            ELSE 4
        END
    FROM [Communication] C
    INNER JOIN [EntityType] E ON E.[Id] = C.[MediumEntityTypeId]
");

            // Drop any custom indexes that might be referencing Communication.MediumEntityTypeId column
            Sql(@"DECLARE @sql NVARCHAR(MAX) = ''

BEGIN
	SELECT @sql += CONCAT (
			'DROP INDEX '
			,object_name(ic.object_id)
			,'.'
			,I.name
			,CHAR(10)
			)
	FROM sys.indexes i
	INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id
		AND ic.index_id = i.index_id
	INNER JOIN sys.columns c ON c.object_id = ic.object_id
		AND c.column_id = ic.column_id
	WHERE c.Name = 'MediumEntityTypeId'
		AND object_name(ic.object_id) = 'Communication'

	EXEC (@sql)
END");


            DropColumn("dbo.Communication", "MediumEntityTypeId");

            // Drop any custom indexes that might be referencing CommunicationTemplate.MediumEntityTypeId column
            Sql(@"DECLARE @sql NVARCHAR(MAX) = ''

BEGIN
	SELECT @sql += CONCAT (
			'DROP INDEX '
			,object_name(ic.object_id)
			,'.'
			,I.name
			,CHAR(10)
			)
	FROM sys.indexes i
	INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id
		AND ic.index_id = i.index_id
	INNER JOIN sys.columns c ON c.object_id = ic.object_id
		AND c.column_id = ic.column_id
	WHERE c.Name = 'MediumEntityTypeId'
		AND object_name(ic.object_id) = 'CommunicationTemplate'

	EXEC (@sql)
END");
            DropColumn("dbo.CommunicationTemplate", "MediumEntityTypeId");

            Sql(MigrationSQL._201709082257551_Communications2_AddCommunicationTemplates);

            // group type
            RockMigrationHelper.AddGroupType("Communication List", "For groups used by Rock's communication tools for storing lists of people to communicate to.", "List", "Recipient", false, true, false, "fa fa-bullhorn", 0, null, 0, null, "D1D95777-FFA3-CBB3-4A6D-658706DAED33");
            RockMigrationHelper.AddGroupTypeRole("D1D95777-FFA3-CBB3-4A6D-658706DAED33", "Recipient", "", 0, null, null, "9D85AB4E-59BC-B48A-494A-5684BA41578E", true, false, true);

            // group attribute
            RockMigrationHelper.AddGroupTypeGroupAttribute("D1D95777-FFA3-CBB3-4A6D-658706DAED33", SystemGuid.FieldType.DATAVIEWS, "Communication Segments", "Additional Communication Segments to be presented when this communication list is selected.", 0, "", "73A53BC1-2178-46A1-8413-C7A4DD49F0B4");
            RockMigrationHelper.AddAttributeQualifier("73A53BC1-2178-46A1-8413-C7A4DD49F0B4", "entityTypeName", "Rock.Model.Person", "37C5CD82-C4D2-4B58-BBCB-D2D59EF4B200");

            // group member attribute
            RockMigrationHelper.AddGroupTypeGroupMemberAttribute("D1D95777-FFA3-CBB3-4A6D-658706DAED33", SystemGuid.FieldType.COMMUNICATION_PREFERENCE_TYPE, "Preferred Communication Type", "The preferred communication type for this group member. Select None to use the person's default communication preference.", 0, "0", "D7941908-1F65-CC9B-416C-CCFABE4221B9");
            RockMigrationHelper.AddAttributeQualifier("D7941908-1F65-CC9B-416C-CCFABE4221B9", "allowmultiple", "False", "AEB4720A-B053-8D92-407E-9B29564882D2");
            RockMigrationHelper.AddAttributeQualifier("D7941908-1F65-CC9B-416C-CCFABE4221B9", "displaydescription", "False", "3A85C857-43E1-6586-41E5-9E9DF7D7D6B0");

            Sql(@"DECLARE @AttributeId int = (SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = 'D7941908-1F65-CC9B-416C-CCFABE4221B9' )
                  DECLARE @DefinedTypeId int = ( SELECT TOP 1 [Id] FROM [DefinedType] WHERE[Guid] = 'BCBE1494-23F5-3683-4EC5-C0B5CACE8A5A' )

                  IF NOT EXISTS (
		                SELECT *
		                FROM AttributeQualifier
		                WHERE [AttributeId] = @AttributeId
                        AND [Key] = 'definedtype'
		                )
                  BEGIN                  
                        INSERT INTO [AttributeQualifier]
                            ([IsSystem], [AttributeId], [Key], [Value], [Guid])
                            VALUES
                            ( 0, @AttributeId, 'definedtype', @DefinedTypeId, newid() )
                  END");

            // group attribute of category
            RockMigrationHelper.AddGroupTypeGroupAttribute("D1D95777-FFA3-CBB3-4A6D-658706DAED33", SystemGuid.FieldType.CATEGORY, "Category", "The category for the communication list.", 0, "", "E3810936-182E-2585-4F8E-030A0E18B27A");
            RockMigrationHelper.AddAttributeQualifier("E3810936-182E-2585-4F8E-030A0E18B27A", "entityTypeName", "Rock.Model.Group", "20AA23EC-B732-B2A8-444E-60CA6FB3C986");
            RockMigrationHelper.AddAttributeQualifier("E3810936-182E-2585-4F8E-030A0E18B27A", "qualifierColumn", "GroupTypeId", "0DFD7DA3-1B68-9E9B-43D6-C415753D6718");
            Sql(@"DECLARE @AttributeId int = (SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = 'E3810936-182E-2585-4F8E-030A0E18B27A' )
                  DECLARE @GroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE[Guid] = 'D1D95777-FFA3-CBB3-4A6D-658706DAED33' )

                  INSERT INTO[AttributeQualifier]
                  ([IsSystem], [AttributeId], [Key], [Value], [Guid])
                  VALUES
                  ( 0, @AttributeId, 'qualifierValue', @GroupTypeId, newid() )");


            // pages
            RockMigrationHelper.AddPage("199DC522-F4D6-4D82-AF44-3C16EE9D2CDA", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Communication List Categories", "", "307570FD-9472-48D5-A67F-80B2056C5308", "fa fa-folder"); // Site:Rock RMS
            RockMigrationHelper.AddPage("199DC522-F4D6-4D82-AF44-3C16EE9D2CDA", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Communication Lists", "", "002C9991-523A-478C-B19B-E9DF2B977481", "fa fa-bullhorn");         // Site:Rock RMS
            RockMigrationHelper.AddPage("002C9991-523A-478C-B19B-E9DF2B977481", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Communication List Detail", "", "60216406-5BD6-4253-B891-262717C07A00", "fa fa-bullhorn");   // Site:Rock RMS
            RockMigrationHelper.AddPage("60216406-5BD6-4253-B891-262717C07A00", "D65F783D-87A9-4CC9-8110-E83466A0EADB", "Group Member Detail", "", "FB3FCA8D-2011-42B5-A9F4-2657C4F856AC", "");                       // Site:Rock RMS

            // Add Block to Page: Communication List Categories, Site: Rock RMS
            RockMigrationHelper.AddBlock("307570FD-9472-48D5-A67F-80B2056C5308", "", "620FC4A2-6587-409F-8972-22065919D9AC", "Categories", "Main", "", "", 0, "25F82ADE-BD0A-404C-A659-30874AFC50A1");
            // Add Block to Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlock("002C9991-523A-478C-B19B-E9DF2B977481", "", "3D7FB6BE-6BBD-49F7-96B4-96310AF3048A", "Group List", "Main", "", "", 0, "426EC86B-5784-411D-94ED-DD007E6DF783");
            // Add Block to Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlock("60216406-5BD6-4253-B891-262717C07A00", "", "582BEEA1-5B27-444D-BC0A-F60CEB053981", "Group Detail", "Main", "", "", 0, "3FF79A87-ABC1-4DE3-B25A-8111E5D05607");
            // Add Block to Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlock("60216406-5BD6-4253-B891-262717C07A00", "", "88B7EFA9-7419-4D05-9F88-38B936E61EDD", "Group Member List", "Main", "", "", 1, "B906C477-BFA2-4617-BCE4-B7A1D3D8042C");
            // Add Block to Page: Group Member Detail, Site: Rock RMS
            RockMigrationHelper.AddBlock("FB3FCA8D-2011-42B5-A9F4-2657C4F856AC", "", "AAE2E5C3-9279-4AB0-9682-F4D19519D678", "Group Member Detail", "Main", "", "", 0, "550684A1-D34C-4198-B87E-5BC5C644A920");
            // update block order for pages with new blocks if the page,zone has multiple blocks
            Sql(@"UPDATE [Block] SET [Order] = 0 WHERE [Guid] = '3FF79A87-ABC1-4DE3-B25A-8111E5D05607'");    // Page: Communication List Detail,  Zone: Main,  Block: Group Detail
            Sql(@"UPDATE [Block] SET [Order] = 0 WHERE [Guid] = '3FF79A87-ABC1-4DE3-B25A-8111E5D05607'");    // Page: Communication List Detail,  Zone: Main,  Block: Group Detail
            Sql(@"UPDATE [Block] SET [Order] = 1 WHERE [Guid] = 'B906C477-BFA2-4617-BCE4-B7A1D3D8042C'");    // Page: Communication List Detail,  Zone: Main,  Block: Group Member List
            Sql(@"UPDATE [Block] SET [Order] = 1 WHERE [Guid] = 'B906C477-BFA2-4617-BCE4-B7A1D3D8042C'");    // Page: Communication List Detail,  Zone: Main,  Block: Group Member List


            // Attrib Value for Block:Categories, Attribute:Entity Type Page: Communication List Categories, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("25F82ADE-BD0A-404C-A659-30874AFC50A1", "C405A507-7889-4287-8342-105B89710044", @"9bbfda11-0d22-40d5-902f-60adfbc88987");
            // Attrib Value for Block:Categories, Attribute:Enable Hierarchy Page: Communication List Categories, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("25F82ADE-BD0A-404C-A659-30874AFC50A1", "F3370A76-E1D1-47FD-AE90-1D428183235C", @"True");
            // Attrib Value for Block:Categories, Attribute:Entity Qualifier Column Page: Communication List Categories, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("25F82ADE-BD0A-404C-A659-30874AFC50A1", "E9E2BE91-5D5E-4688-A6AD-A4AAD3D629E2", @"GroupTypeId");
            // Attrib Value for Block:Categories, Attribute:Entity Qualifier Value Page: Communication List Categories, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("25F82ADE-BD0A-404C-A659-30874AFC50A1", "E3CC4A91-697C-4269-8AA8-E1F1A63F04D8", @"31");
            // Attrib Value for Block:Group List, Attribute:Display Member Count Column Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "FDD84597-E3E8-4E91-A72F-C6538B085310", @"True");
            // Attrib Value for Block:Group List, Attribute:Limit to Active Status Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "B4133552-42B6-4053-90B9-33B882B72D2D", @"all");
            // Attrib Value for Block:Group List, Attribute:Display Group Path Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "6F229535-B44E-44C2-A9AF-28244600E244", @"False");
            // Attrib Value for Block:Group List, Attribute:Display Filter Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "7E0EDF09-9374-4AC4-8591-30C08D7F1E1F", @"True");
            // Attrib Value for Block:Group List, Attribute:Include Group Types Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "5164FF88-A53B-4982-BE50-D56F1FE13FC6", @"d1d95777-ffa3-cbb3-4a6d-658706daed33");
            // Attrib Value for Block:Group List, Attribute:Exclude Group Types Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "0901CBFE-1980-4A1C-8AF0-4A8BD0FC46E9", @"");
            // Attrib Value for Block:Group List, Attribute:Display Group Type Column Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "951D268A-B2A8-42A2-B1C1-3B854070DDF9", @"False");
            // Attrib Value for Block:Group List, Attribute:Display Description Column Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "A0E1B2A4-9D86-4F57-B608-FC7CC498EAC3", @"True");
            // Attrib Value for Block:Group List, Attribute:Limit to Security Role Groups Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "1DAD66E3-8859-487E-8200-483C98DE2E07", @"False");
            // Attrib Value for Block:Group List, Attribute:Detail Page Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "8E57EC42-ABEE-4D35-B7FA-D8513880E8E4", @"60216406-5bd6-4253-b891-262717c07a00");
            // Attrib Value for Block:Group List, Attribute:Display System Column Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "766A4BFA-D2D1-4744-B30D-637A7E3B9D8F", @"False");
            // Attrib Value for Block:Group List, Attribute:Display Active Status Column Page: Communication Lists, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("426EC86B-5784-411D-94ED-DD007E6DF783", "FCB5F8B3-9C0E-46A8-974A-15353447FCD7", @"True");
            // Attrib Value for Block:Group Detail, Attribute:Group Map Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "69F9C989-456D-4855-A420-050DB8B9FEB7", @"");
            // Attrib Value for Block:Group Detail, Attribute:Map Style Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "E50B6C24-930C-4D9C-BD94-0AD6BC018C4D", @"fdc5d6ba-a818-4a06-96b1-9ef31b4087ac");
            // Attrib Value for Block:Group Detail, Attribute:Group Types Exclude Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "85EE581F-D246-498A-B857-5AD33EC3CAEA", @"");
            // Attrib Value for Block:Group Detail, Attribute:Registration Instance Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "36643FFE-C49F-443E-8C3D-E83324A45822", @"844dc54b-daec-47b3-a63a-712dd6d57793");
            // Attrib Value for Block:Group Detail, Attribute:Event Item Occurrence Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "6114CE99-C97F-4394-93F5-B34D479AB54E", @"4b0c44ee-28e3-4753-a95b-8c57cd958fd1");
            // Attrib Value for Block:Group Detail, Attribute:Content Item Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "45897721-F38C-4B4B-BCF9-A81D27DBB731", @"d18e837c-9e65-4a38-8647-dff04a595d97");
            // Attrib Value for Block:Group Detail, Attribute:Show Edit Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "50C7E223-459E-4A1C-AE3C-2892CBD40D22", @"True");

            // Attrib Value for Block:Group Detail, Attribute:Group Types Include Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "15AC7A62-7BF2-44B7-93CD-EA8F96BF529A", @"d1d95777-ffa3-cbb3-4a6d-658706daed33");

            // Attrib Value for Block:Group Detail, Attribute:Limit to Security Role Groups Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "12295C7E-08F4-4AC5-8A34-C829620FC0B1", @"False");
            // Attrib Value for Block:Group Detail, Attribute:Limit to Group Types that are shown in navigation Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("3FF79A87-ABC1-4DE3-B25A-8111E5D05607", "62B0099E-B1A3-4468-B821-B96AB088A861", @"False");
            // Attrib Value for Block:Group Member List, Attribute:Detail Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "E4CCB79C-479F-4BEE-8156-969B2CE05973", @"fb3fca8d-2011-42b5-a9f4-2657c4f856ac");
            // Attrib Value for Block:Group Member List, Attribute:Person Profile Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "9E139BB9-D87C-4C9F-A241-DC4620AD340B", @"08dbd8a5-2c35-4146-b4a8-0f7652348b25");
            // Attrib Value for Block:Group Member List, Attribute:Registration Page Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "EDF79295-04A4-42B4-B382-DDEF5888D565", @"fc81099a-2f98-4eba-ac5a-8300b2fe46c4");
            // Attrib Value for Block:Group Member List, Attribute:Show Campus Filter Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "5796D8C1-0F65-48C2-8920-8C9521E974FF", @"True");
            // Attrib Value for Block:Group Member List, Attribute:Show First/Last Attendance Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "3BFE216F-9CAC-42FF-AC62-427557351F31", @"False");
            // Attrib Value for Block:Group Member List, Attribute:Show Date Added Page: Communication List Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue("B906C477-BFA2-4617-BCE4-B7A1D3D8042C", "7BC3F3B7-8354-4B1C-B8F8-DEDEC5D8A0BD", @"False");

            RockMigrationHelper.UpdateCategory(Rock.SystemGuid.EntityType.DATAVIEW, "Communication Segments", string.Empty, "Dataviews that can be used to refine a communication recipient list when creating a communication", "FF7081F8-7223-43D4-BE28-CB030DC4E13B");

            // Create [GroupAll] DataViewFilter for DataView: 35 and older
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '6D8E0255-2BEE-4E7F-AD79-1A224E07D5AF') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '00000000-0000-0000-0000-000000000000'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '00000000-0000-0000-0000-000000000000')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (1,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'','6D8E0255-2BEE-4E7F-AD79-1A224E07D5AF')
END
");
            // Create Rock.Reporting.DataFilter.Person.AgeFilter DataViewFilter for DataView: 35 and older
            /* NOTE to Developer. Review that the generated DataViewFilter.Selection '256|35|,' for Rock.Reporting.DataFilter.Person.AgeFilter will work on different databases */
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '90563175-E8C6-4845-9D60-78C0BBD5A9BE') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '6D8E0255-2BEE-4E7F-AD79-1A224E07D5AF'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '4911C63D-71BB-4686-AAA3-D66EA41DA465')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (0,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'256|35|,','90563175-E8C6-4845-9D60-78C0BBD5A9BE')
END
");
            // Create DataView: 35 and older
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataView where [Guid] = '5537D54C-1B9B-4B81-AA63-F10D676FAE77') BEGIN
DECLARE
    @categoryId int = (select top 1 [Id] from [Category] where [Guid] = 'FF7081F8-7223-43D4-BE28-CB030DC4E13B'),
    @entityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '72657ED8-D16E-492E-AC12-144C5E7567E7'),
    @dataViewFilterId  int = (select top 1 [Id] from [DataViewFilter] where [Guid] = '6D8E0255-2BEE-4E7F-AD79-1A224E07D5AF'),
    @transformEntityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '00000000-0000-0000-0000-000000000000')

INSERT INTO [DataView] ([IsSystem], [Name], [Description], [CategoryId], [EntityTypeId], [DataViewFilterId], [TransformEntityTypeId], [Guid])
VALUES(0,'35 and older','A filter to help refine a communications recipient list to include only people that are 35 and older',@categoryId,@entityTypeId,@dataViewFilterId,@transformEntityTypeId,'5537D54C-1B9B-4B81-AA63-F10D676FAE77')
END
");

            // Create [GroupAll] DataViewFilter for DataView: Female
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '01CDD06D-810E-4861-85EE-69FB8C97EA3C') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '00000000-0000-0000-0000-000000000000'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '00000000-0000-0000-0000-000000000000')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (1,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'','01CDD06D-810E-4861-85EE-69FB8C97EA3C')
END
");
            // Create Rock.Reporting.DataFilter.PropertyFilter DataViewFilter for DataView: Female

            /* NOTE to Developer. Review that the generated DataViewFilter.Selection '[
             * "Property_Gender",
             * "Female"
             * ]' for Rock.Reporting.DataFilter.PropertyFilter will work on different databases */
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = 'CD9ADB66-67E5-4F3E-A481-13EE257407EC') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '01CDD06D-810E-4861-85EE-69FB8C97EA3C'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '03F0D6AC-D181-48B6-B4BC-1F2652B55323')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (0,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'[
  ""Property_Gender"",
  ""Female""
]','CD9ADB66-67E5-4F3E-A481-13EE257407EC')
END
");
            // Create DataView: Female
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataView where [Guid] = 'E2CC2258-BF35-4DB2-91E2-9BE1B68156A3') BEGIN
DECLARE
    @categoryId int = (select top 1 [Id] from [Category] where [Guid] = 'FF7081F8-7223-43D4-BE28-CB030DC4E13B'),
    @entityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '72657ED8-D16E-492E-AC12-144C5E7567E7'),
    @dataViewFilterId  int = (select top 1 [Id] from [DataViewFilter] where [Guid] = '01CDD06D-810E-4861-85EE-69FB8C97EA3C'),
    @transformEntityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '00000000-0000-0000-0000-000000000000')

INSERT INTO [DataView] ([IsSystem], [Name], [Description], [CategoryId], [EntityTypeId], [DataViewFilterId], [TransformEntityTypeId], [Guid])
VALUES(0,'Female','A filter to help refine a communications recipient list to include only females',@categoryId,@entityTypeId,@dataViewFilterId,@transformEntityTypeId,'E2CC2258-BF35-4DB2-91E2-9BE1B68156A3')
END
");

            // Create [GroupAll] DataViewFilter for DataView: Male
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '348FF1A5-2D80-4FC6-86AF-0FC3C117982A') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '00000000-0000-0000-0000-000000000000'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '00000000-0000-0000-0000-000000000000')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (1,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'','348FF1A5-2D80-4FC6-86AF-0FC3C117982A')
END
");
            // Create Rock.Reporting.DataFilter.PropertyFilter DataViewFilter for DataView: Male

            /* NOTE to Developer. Review that the generated DataViewFilter.Selection '[
             * "Property_Gender",
             * "Male"
             * ]' for Rock.Reporting.DataFilter.PropertyFilter will work on different databases */
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '03D9CA62-4F58-43C6-A508-AE8597B27539') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '348FF1A5-2D80-4FC6-86AF-0FC3C117982A'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '03F0D6AC-D181-48B6-B4BC-1F2652B55323')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (0,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'[
  ""Property_Gender"",
  ""Male""
]','03D9CA62-4F58-43C6-A508-AE8597B27539')
END
");
            // Create DataView: Male
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataView where [Guid] = 'C43983D7-1F22-4E94-9F5C-342DA3A0E168') BEGIN
DECLARE
    @categoryId int = (select top 1 [Id] from [Category] where [Guid] = 'FF7081F8-7223-43D4-BE28-CB030DC4E13B'),
    @entityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '72657ED8-D16E-492E-AC12-144C5E7567E7'),
    @dataViewFilterId  int = (select top 1 [Id] from [DataViewFilter] where [Guid] = '348FF1A5-2D80-4FC6-86AF-0FC3C117982A'),
    @transformEntityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '00000000-0000-0000-0000-000000000000')

INSERT INTO [DataView] ([IsSystem], [Name], [Description], [CategoryId], [EntityTypeId], [DataViewFilterId], [TransformEntityTypeId], [Guid])
VALUES(0,'Male','A filter to help refine a communications recipient list to include only males',@categoryId,@entityTypeId,@dataViewFilterId,@transformEntityTypeId,'C43983D7-1F22-4E94-9F5C-342DA3A0E168')
END
");

            // Create [GroupAll] DataViewFilter for DataView: Under 35
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '8760D688-01B9-4030-BF19-898D68CBA757') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '00000000-0000-0000-0000-000000000000'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '00000000-0000-0000-0000-000000000000')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (1,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'','8760D688-01B9-4030-BF19-898D68CBA757')
END
");
            // Create Rock.Reporting.DataFilter.Person.AgeFilter DataViewFilter for DataView: Under 35
            /* NOTE to Developer. Review that the generated DataViewFilter.Selection '512|35|,' for Rock.Reporting.DataFilter.Person.AgeFilter will work on different databases */
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataViewFilter where [Guid] = '9423C06E-C5D3-4589-8EA7-813A6F59F13B') BEGIN    
    DECLARE
        @ParentDataViewFilterId int = (select Id from DataViewFilter where [Guid] = '8760D688-01B9-4030-BF19-898D68CBA757'),
        @DataViewFilterEntityTypeId int = (select Id from EntityType where [Guid] = '4911C63D-71BB-4686-AAA3-D66EA41DA465')

    INSERT INTO [DataViewFilter] (ExpressionType, ParentId, EntityTypeId, Selection, [Guid]) 
    values (0,@ParentDataViewFilterId,@DataViewFilterEntityTypeId,'512|35|,','9423C06E-C5D3-4589-8EA7-813A6F59F13B')
END
");
            // Create DataView: Under 35
            Sql(@"
IF NOT EXISTS (SELECT * FROM DataView where [Guid] = 'FF608842-BB10-4C9C-AA18-9D5C407590D3') BEGIN
DECLARE
    @categoryId int = (select top 1 [Id] from [Category] where [Guid] = 'FF7081F8-7223-43D4-BE28-CB030DC4E13B'),
    @entityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '72657ED8-D16E-492E-AC12-144C5E7567E7'),
    @dataViewFilterId  int = (select top 1 [Id] from [DataViewFilter] where [Guid] = '8760D688-01B9-4030-BF19-898D68CBA757'),
    @transformEntityTypeId  int = (select top 1 [Id] from [EntityType] where [Guid] = '00000000-0000-0000-0000-000000000000')

INSERT INTO [DataView] ([IsSystem], [Name], [Description], [CategoryId], [EntityTypeId], [DataViewFilterId], [TransformEntityTypeId], [Guid])
VALUES(0,'Under 35','A filter to help refine a communications recipient list to include only people that under age of 35',@categoryId,@entityTypeId,@dataViewFilterId,@transformEntityTypeId,'FF608842-BB10-4C9C-AA18-9D5C407590D3')
END
");

            // Job for Migrating Interaction Data
            Sql(@"
    INSERT INTO [dbo].[ServiceJob] ( [IsSystem], [IsActive], [Name], [Description], [Class], [CronExpression], [NotificationStatus] ,[Guid] )
    VALUES ( 0, 1, 'Convert communication medium data', 'Converts communication medium data to field values.', 
        'Rock.Jobs.MigrateCommunicationMediumData', '0 0 3 1/1 * ? *', 3, 'E7C54AAB-451E-4E89-8083-CF398D37416E')");
        }
        /// <summary>
        /// The commands to run to migrate plugin to the specific version
        /// </summary>
        public override void Up()
        {
            var migrateNamespace = false;
            var oldNamespace     = "com.kfs.GroupRSVP";

            // check if migration has previously run
            using (var rockContext = new RockContext())
            {
                var migrationNumber = (System.Attribute.GetCustomAttribute(this.GetType(), typeof(MigrationNumberAttribute)) as MigrationNumberAttribute).Number;
                migrateNamespace = new PluginMigrationService(rockContext)
                                   .Queryable()
                                   .Where(m => m.PluginAssemblyName.Equals(oldNamespace, StringComparison.CurrentCultureIgnoreCase) && m.MigrationNumber == migrationNumber)
                                   .Any();
            }

            if (migrateNamespace)
            {
                UpdateBlockTypeByGuid("RSVP Group Registration", "Allows a person to register for an RSVP Group.", "~/Plugins/rocks_kfs/RsvpGroups/RsvpGroupRegistration.ascx", "KFS > RSVP Groups", "F7B249C3-7FFD-483D-820F-A44D04E2BAB1");
                UpdateBlockTypeByGuid("Group List Lava", "Lists groups for lava display.", "~/Plugins/rocks_kfs/Groups/GroupListLava.ascx", "KFS > Groups", "6731AF9D-F3CB-4CCB-AA42-19C9CB15CBF5");   // shared block type
            }
            else
            {
                // group type
                RockMigrationHelper.AddGroupType("RSVP Group", "A group that can be used to manage RSVP counts for the group members.", "Group", "Member", false, true, true, "fa fa-clipboard-list", 0, "", 0, "", "1A082EFF-30DA-44B2-8E48-02385C20828E", true);

                // group type role
                RockMigrationHelper.AddGroupTypeRole("1A082EFF-30DA-44B2-8E48-02385C20828E", "Member", "", 0, null, null, "60E0B95A-04D3-4839-917B-6BDAF9808EB5", true, false, true);

                // max rsvp
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.INTEGER, "Max RSVP", "The RSVP limit for this group. '0' is unlimited.", 0, "", "AE34AFA5-8CB0-4BDA-8ACB-BAB661803BDC", true);

                // send email
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.BOOLEAN, "Send Email", "Flag indicating if the group email should be sent when someone joins this group.", 1, "False", "9B67F3BF-5F7A-4A9E-A352-67F3D515F63A", true);

                // from email
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.EMAIL, "From Email", "", 2, "", "6F8FB284-4CCB-45C1-A99E-F8ADA93856B1");

                // from name
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.TEXT, "From Name", "", 3, "", "9BBE3207-1939-45E3-8A26-6519045E8EA9");
                RockMigrationHelper.AddAttributeQualifier("9BBE3207-1939-45E3-8A26-6519045E8EA9", "ispassword", "false", "8F791A08-72BC-482E-8FBC-8F6463C9669E");

                // subject
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.TEXT, "Subject", "", 4, "", "C0AD8B37-4D7F-4C17-9B4E-1E8D4352E22D");
                RockMigrationHelper.AddAttributeQualifier("C0AD8B37-4D7F-4C17-9B4E-1E8D4352E22D", "ispassword", "false", "7284B714-AF12-440C-91FE-C4850F0D75F8");

                // message
                RockMigrationHelper.AddGroupTypeGroupAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.HTML, "Message", "", 5, "", "7DCB5A58-1FD2-4261-9483-EA65A97151CD");
                RockMigrationHelper.AddAttributeQualifier("7DCB5A58-1FD2-4261-9483-EA65A97151CD", "documentfolderroot", "", "B3C8C1C5-2DEB-49DA-87A8-8B87D48C9ED2");
                RockMigrationHelper.AddAttributeQualifier("7DCB5A58-1FD2-4261-9483-EA65A97151CD", "imagefolderroot", "", "C5CA6A49-E7A7-45AA-B9F4-85F8F6FA8B5D");
                RockMigrationHelper.AddAttributeQualifier("7DCB5A58-1FD2-4261-9483-EA65A97151CD", "toolbar", "Light", "242E3FFC-0680-494F-9EA3-55E8BEF11477");
                RockMigrationHelper.AddAttributeQualifier("7DCB5A58-1FD2-4261-9483-EA65A97151CD", "userspecificroot", "False", "A59A34A7-0EA8-414C-A78F-034FFE954768");

                // member rsvp
                RockMigrationHelper.AddGroupTypeGroupMemberAttribute("1A082EFF-30DA-44B2-8E48-02385C20828E", Rock.SystemGuid.FieldType.INTEGER, "RSVP Count", "", 0, "1", "877D17DD-6303-4863-B87C-F8D05111E835", true);

                // set member rsvp to display in grid, set the association to be self referenced, and set role to view
                Sql(@"
                    DECLARE @GroupMemberRsvpCount INT = (SELECT TOP 1 [Id] FROM [Attribute] WHERE [Guid] = '877D17DD-6303-4863-B87C-F8D05111E835')
                    UPDATE [Attribute]
                    SET [IsGridColumn] = 1
                    WHERE [Id] = @GroupMemberRsvpCount

                    DECLARE @RsvpGroupTypeId INT = (SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '1A082EFF-30DA-44B2-8E48-02385C20828E')
                    INSERT INTO [GroupTypeAssociation] ( [GroupTypeId], [ChildGroupTypeId] )
                    SELECT @RsvpGroupTypeId, @RsvpGroupTypeId

                    UPDATE [GroupTypeRole]
                    SET [CanView] = 1
                    WHERE [GroupTypeId] = @RsvpGroupTypeId
                ");

                // register blocks
                UpdateBlockTypeByGuid("RSVP Group Registration", "Allows a person to register for an RSVP Group.", "~/Plugins/rocks_kfs/RsvpGroups/RsvpGroupRegistration.ascx", "KFS > RSVP Groups", "F7B249C3-7FFD-483D-820F-A44D04E2BAB1");
                UpdateBlockTypeByGuid("Group List Lava", "Lists groups for lava display.", "~/Plugins/rocks_kfs/Groups/GroupListLava.ascx", "KFS > Groups", "6731AF9D-F3CB-4CCB-AA42-19C9CB15CBF5");   // shared block type
            }
        }