/// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.AddGroupType("Check in by Data View", "", "Group", "Member", false, false, false, "", 0, "", 0, "6BCED84C-69AD-4F5A-9197-5C0F9C02DD34", "DC7ED2FD-5F88-4760-B3C8-494EDB1CFC06", true);
            RockMigrationHelper.AddGroupTypeGroupAttribute("DC7ED2FD-5F88-4760-B3C8-494EDB1CFC06", SystemGuid.FieldType.DATAVIEWS, "Data View", "The data view a person must be included in to be able to check into this group.", 0, "", "E8F8498F-5C51-4216-AC81-875349D6C2D0");
            RockMigrationHelper.AddAttributeQualifier("E8F8498F-5C51-4216-AC81-875349D6C2D0", "entityTypeName", "Rock.Model.Person", "D59BAD04-4C23-497C-810A-328B760B7C6B");

            RockMigrationHelper.UpdateEntityType("Rock.Workflow.Action.CheckIn.FilterGroupsByDataView", "E6490F9B-21C6-4D0F-AD15-9729AC22C094", false, true);
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("E6490F9B-21C6-4D0F-AD15-9729AC22C094", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "0B1FF2A0-D0CE-42A5-95BC-C65F02D14399");
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("E6490F9B-21C6-4D0F-AD15-9729AC22C094", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "869473D0-AC93-4F8F-B164-2A332571E779");
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("E6490F9B-21C6-4D0F-AD15-9729AC22C094", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Remove", "Remove", "Select 'Yes' if groups should be removed.  Select 'No' if they should just be marked as excluded.", 0, @"True", "5EE8CC8E-455D-4115-88F4-81D224A30A28");

            RockMigrationHelper.UpdateWorkflowActionType("EB744DF1-E454-482C-B111-80A54EF8A674", "Filter Groups by DataView", 0, "E6490F9B-21C6-4D0F-AD15-9729AC22C094", true, false, "", "66EF6CB1-1A96-2F81-4534-3BCA5C33D4CD", 1, "False", "31F407AA-50BB-4915-BB22-7AF463989D98");

            Sql(@"
    -- Fix the ordering of the Unattended Check-in Id: 10 workflow activity so that the 'Filter By Data View' activity is immediately after 'Filter By Gender'
    DECLARE @ActivityTypeId int = ( SELECT TOP 1 [Id] FROM [WorkflowActivityType] WHERE [Guid] = 'EB744DF1-E454-482C-B111-80A54EF8A674' )
    DECLARE @EntityTypeId int = ( SELECT TOP 1 [Id] FROM [EntityType] WHERE [Name] = 'Rock.Workflow.Action.CheckIn.FilterGroupsByGender' )
    DECLARE @Order int = ISNULL( ( SELECT TOP 1 [Order] FROM [WorkflowActionType] WHERE [ActivityTypeId] = @ActivityTypeId AND [EntityTypeId] = @EntityTypeId ), 0)
    IF @Order IS NOT NULL AND @Order > 0
    BEGIN
        UPDATE [WorkflowActionType] SET [Order] = [Order] + 1 WHERE [ActivityTypeId] = @ActivityTypeId AND [Order] > @Order
        UPDATE [WorkflowActionType] SET [Order] = @Order + 1 WHERE [Guid] = '31F407AA-50BB-4915-BB22-7AF463989D98'
    END
");
        }
Esempio n. 2
0
        public override void Up()
        {
            //Childrens checkin base
            RockMigrationHelper.AddGroupType("Children Check-In", "Base checkin group for all of check-in.", "Group", "Member", false, false, false,
                                             "", 100, Constants.GROUP_TYPE_BY_BASE, 0, Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER, Constants.GROUP_TYPE_BY_CHILDREN_CHECKIN_BASE);
            RockMigrationHelper.AddGroupTypeGroupAttribute("5398A1C2-F422-4ADC-A48B-B9EFFE3598AD", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Link Locations", @"Should all all locations for this group be required to be the same?", 0, "False", "0A8723A4-4AEE-4D21-A32B-350845FC8FA9", "");
            RockMigrationHelper.AddGroupTypeGroupAttribute("5398A1C2-F422-4ADC-A48B-B9EFFE3598AD", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Is Volunteer", @"Do people checking into this group count as volunteers?", 1, "", "F5DAD320-B77D-4282-98C9-35414FB0A6DC", "");
            RockMigrationHelper.AddGroupTypeGroupAttribute("5398A1C2-F422-4ADC-A48B-B9EFFE3598AD", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Give Priority", @"", 2, "False", "DABEABAC-F052-471B-AC61-A7630465888B", "");

            //Checkin by Birthday
            RockMigrationHelper.AddGroupType("Check in by Birthday", "Checkin filter using birthdays.", "Group", "Member", false, false, false,
                                             "", 101, Constants.GROUP_TYPE_BY_CHILDREN_CHECKIN_BASE, 0, Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER, Constants.GROUP_TYPE_BY_BIRTHDAY);
            RockMigrationHelper.AddGroupTypeGroupAttribute("3600C17B-1D92-4929-B7B7-BBC156F2D47A", "9C7D431C-875C-4792-9E76-93F3A32BB850", "Date Range", @"", 0, "", "DABCC6EA-29EE-41EA-83DC-C2DF0065631D", "");
            RockMigrationHelper.AddGroupTypeGroupAttribute("3600C17B-1D92-4929-B7B7-BBC156F2D47A", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Filter GradeSchool Students", @"", 1, "", "8919515B-D654-43AA-A429-91A2B8A092CF", "");


            //Checkin by Membership
            RockMigrationHelper.AddGroupType("Check in by Membership", "Checkin filter using group membership.", "Group", "Member", false, false, false,
                                             "", 102, Constants.GROUP_TYPE_BY_CHILDREN_CHECKIN_BASE, 0, Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER, Constants.GROUP_TYPE_BY_MEMBERSHIP);
            RockMigrationHelper.AddGroupTypeGroupAttribute("2098AE58-58D4-4CEF-8D40-C2657D2E7A6A", "F4399CEF-827B-48B2-A735-F7806FCFE8E8", "Group", @"", 0, null, "22C7D86E-ABEA-4DFB-A83C-FC18100C9834", "");
            RockMigrationHelper.AddGroupTypeGroupAttribute(Constants.GROUP_TYPE_BY_MEMBERSHIP, Rock.SystemGuid.FieldType.SINGLE_SELECT, "Check Requirements",
                                                           "Should the requirements of the group be checked before allowing check-in. This is slower but needed in some situations.",
                                                           5, "0", Constants.GROUP_ATTRIBUTE_CHECK_REQUIREMENTS, false);
            RockMigrationHelper.AddAttributeQualifier(Constants.GROUP_ATTRIBUTE_CHECK_REQUIREMENTS, "values", "0^Do Not Check,1^Check Required Only,2^Check Required and Warning", "9E659023-6860-4872-B7C9-EB019FF76145");
            RockMigrationHelper.AddGroupTypeGroupAttribute(Constants.GROUP_TYPE_BY_MEMBERSHIP, Rock.SystemGuid.FieldType.SINGLE_SELECT, "Member Role",
                                                           "Optional filter to only allow people if they are a member or leader.",
                                                           6, "0", Constants.GROUP_ATTRIBUTE_MEMBER_ROLE, false);
            RockMigrationHelper.AddAttributeQualifier(Constants.GROUP_ATTRIBUTE_MEMBER_ROLE, "values", "0^Any,1^Leaders Only,2^Non Leaders Only", "840B04D7-DC1B-452B-A869-0AEB4904DC26");
            RockMigrationHelper.AddGroupTypeGroupAttribute(Constants.GROUP_TYPE_BY_MEMBERSHIP, Rock.SystemGuid.FieldType.BOOLEAN, "Save Attendance To Group",
                                                           "If selected, the attendance will be set on the group the person is a member of instead of on the check-in group.",
                                                           7, "False", Constants.GROUP_ATTRIBUTE_ATTENDANCE_ON_GROUP);
        }
Esempio n. 3
0
 public override void Up()
 {
     RockMigrationHelper.AddGroupType("Rise Learning Group", "Groups that are mirrored in the Rise learning management system.",
                                      "Group", "Member", false, true, true, "fa fa-chalkboard", 100, "", 0, "", Constants.GROUPTYPE_RISE);
     RockMigrationHelper.AddGroupTypeRole(Constants.GROUPTYPE_RISE, "Learner", "", 0, null, null,
                                          "41DF5756-4D66-4BDE-841A-300C25680354", true, false, true);
     RockMigrationHelper.AddGroupTypeGroupAttribute(Constants.GROUPTYPE_RISE, Rock.SystemGuid.FieldType.TEXT, "Rise Group Id",
                                                    "The id of the group in the Rise learning system.", 0, "", Constants.GROUP_ATTRIBUTE_RISEID);
     RockMigrationHelper.AddGroupTypeGroupAttribute(Constants.GROUPTYPE_RISE, Rock.SystemGuid.FieldType.TEXT, "Rise Group Url",
                                                    "The url of the group in the Rise learning system.", 1, "", "ABF5A7DA-B8B7-4446-8124-139CE3E90870");
 }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            // Add 'Campus Team' GroupType
            RockMigrationHelper.AddGroupType("Campus Team", "Used to track groups that serve a given Campus.", "Group", "Member", false, false, false, null, 0, null, 0, null, SystemGuid.GroupType.GROUPTYPE_CAMPUS_TEAM, true);

            // Add default Roles to 'Campus Team' GroupType
            RockMigrationHelper.AddGroupTypeRole(SystemGuid.GroupType.GROUPTYPE_CAMPUS_TEAM, "Pastor", "Pastor of a Campus", 0, 1, null, SystemGuid.GroupRole.GROUPROLE_CAMPUS_TEAM_PASTOR, true, true, false);
            RockMigrationHelper.AddGroupTypeRole(SystemGuid.GroupType.GROUPTYPE_CAMPUS_TEAM, "Administrator", "Administrator of a Campus", 1, null, null, SystemGuid.GroupRole.GROUPROLE_CAMPUS_TEAM_ADMINISTRATOR, true, false, true);

            // Add 'Group Member Detail' Page to 'Campus Detail' Page
            RockMigrationHelper.AddPage(true, SystemGuid.Page.CAMPUS_DETAIL, SystemGuid.Layout.FULL_WIDTH_INTERNAL_SITE, "Group Member Detail", "", SystemGuid.Page.GROUP_MEMBER_DETAIL_CAMPUS_DETAIL, "fa fa-users"); // Site:Rock RMS
            RockMigrationHelper.AddPageRoute(SystemGuid.Page.GROUP_MEMBER_DETAIL_CAMPUS_DETAIL, "Campus/{CampusId}/GroupMember/{GroupMemberId}", SystemGuid.PageRoute.GROUP_MEMBER_DETAIL_CAMPUS_DETAIL);              // for Page:Group Member Detail

            // Add Block to Page: Campus Detail Site: Rock RMS
            RockMigrationHelper.AddBlock(true, SystemGuid.Page.CAMPUS_DETAIL.AsGuid(), null, SystemGuid.Site.SITE_ROCK_INTERNAL.AsGuid(), SystemGuid.BlockType.GROUPS_GROUP_MEMBER_LIST.AsGuid(), "Group Member List", "Main", @"", @"", 1, SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST);

            // update block order for pages with new blocks if the page,zone has multiple blocks
            Sql($@"UPDATE [Block] SET [Order] = 0 WHERE [Guid] = '{SystemGuid.Block.CAMPUS_DETAIL_CAMPUS_DETAIL}'");     // Page: Campus Detail,  Zone: Main,  Block: Campus Detail
            Sql($@"UPDATE [Block] SET [Order] = 1 WHERE [Guid] = '{SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST}'"); // Page: Campus Detail,  Zone: Main,  Block: Group Member List

            // Attrib Value for Block:Group Member List, Attribute:Show Note Column Page: Campus Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST, "5F54C068-1418-44FA-B215-FBF70072F6A5", @"False");
            // Attrib Value for Block:Group Member List, Attribute:Show Date Added Page: Campus Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST, "F281090E-A05D-4F81-AD80-A3599FB8E2CD", @"False");
            // Attrib Value for Block:Group Member List, Attribute:Show Campus Filter Page: Campus Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST, "65B9EA6C-D904-4105-8B51-CCA784DDAAFA", @"True");
            // Attrib Value for Block:Group Member List, Attribute:Show First/Last Attendance Page: Campus Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST, "65834FB0-0AB0-4F73-BE1B-9D2F9FFD2664", @"False");
            // Attrib Value for Block:Group Member List, Attribute:Detail Page Page: Campus Detail, Site: Rock RMS
            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_LIST, "E4CCB79C-479F-4BEE-8156-969B2CE05973", @"eb135ae0-5bac-458b-ad5b-47460c2bfd31,9660b9fb-c90f-4afe-9d58-c0ec271c1377");

            // Add Block to Page: Group Member Detail Site: Rock RMS
            RockMigrationHelper.AddBlock(true, SystemGuid.Page.GROUP_MEMBER_DETAIL_CAMPUS_DETAIL.AsGuid(), null, SystemGuid.Site.SITE_ROCK_INTERNAL.AsGuid(), SystemGuid.BlockType.GROUPS_GROUP_MEMBER_DETAIL.AsGuid(), "Group Member Detail", "Main", @"", @"", 0, SystemGuid.Block.CAMPUS_DETAIL_GROUP_MEMBER_DETAIL);

            // Seed all existing Campuses with a new 'TeamGroup' Group association
            Sql(RockMigrationSQL._202002182236274_AddCampusTeamToAllCampuses_Up);

            // Add 'PersonGetCampusTeamMember' Action to the EntityType table
            RockMigrationHelper.UpdateEntityType("Rock.Workflow.Action.PersonGetCampusTeamMember", SystemGuid.EntityType.PERSON_GET_CAMPUS_TEAM_MEMBER, false, true);

            // Add 'PersonGetCampusTeamMember' Action's Attributes
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute(SystemGuid.EntityType.PERSON_GET_CAMPUS_TEAM_MEMBER, SystemGuid.FieldType.WORKFLOW_ATTRIBUTE, "Person", "Person", "Workflow attribute that contains the person to get the Campus team member for.", 0, @"", SystemGuid.Attribute.WORKFLOW_ACTION_PERSON_GET_CAMPUS_TEAM_MEMBER_PERSON);
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute(SystemGuid.EntityType.PERSON_GET_CAMPUS_TEAM_MEMBER, SystemGuid.FieldType.WORKFLOW_ATTRIBUTE, "Campus", "Campus", "Workflow attribute that contains the Campus to get the Campus team member for. If both Person and Campus are provided, Campus takes precedence over the Person's Campus. If Campus is not provided, the Person's primary Campus will be assigned to this attribute.", 1, @"", SystemGuid.Attribute.WORKFLOW_ACTION_PERSON_GET_CAMPUS_TEAM_MEMBER_CAMPUS);
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute(SystemGuid.EntityType.PERSON_GET_CAMPUS_TEAM_MEMBER, SystemGuid.FieldType.WORKFLOW_ATTRIBUTE, "Campus Role", "CampusRole", "Workflow attribute that contains the Role of the Campus team member to get. If multiple team members are in this role for a given Campus, the first match will be selected.", 2, @"", SystemGuid.Attribute.WORKFLOW_ACTION_PERSON_GET_CAMPUS_TEAM_MEMBER_CAMPUS_ROLE);
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute(SystemGuid.EntityType.PERSON_GET_CAMPUS_TEAM_MEMBER, SystemGuid.FieldType.WORKFLOW_ATTRIBUTE, "Campus Team Member", "CampusTeamMember", "Workflow attribute to assign the Campus team member to.", 3, @"", SystemGuid.Attribute.WORKFLOW_ACTION_PERSON_GET_CAMPUS_TEAM_MEMBER_CAMPUS_TEAM_MEMBER);
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.AddGroupType("Check In", "A base group type that can be inherited from to support check in without any filters.", "Group", "Member", false, false, false, "", 0, null, 0, "6BCED84C-69AD-4F5A-9197-5C0F9C02DD34", "6E7AD783-7614-4721-ABC1-35842113EF59", false);
            RockMigrationHelper.AddGroupType("Volunteer Check-in Area", "", "Group", "Member", false, false, false, "", 0, null, 0, "4A406CB0-495B-4795-B788-52BDFDE00B01", "92435F1D-E525-4FD2-BEC7-4956DC056A2B", false);

            Sql(@"
    DECLARE @CheckInGroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '6E7AD783-7614-4721-ABC1-35842113EF59' )
    DECLARE @VolunteerAreaGroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '92435F1D-E525-4FD2-BEC7-4956DC056A2B' )
    DECLARE @ServingGroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '2C42B2D4-1C5F-4AD5-A9AD-08631B872AC4' )

    IF @VolunteerAreaGroupTypeId IS NOT NULL 
    BEGIN

        INSERT INTO [GroupTypeAssociation] ( [GroupTypeId], [ChildGroupTypeId] )
	    VALUES ( @VolunteerAreaGroupTypeId, @VolunteerAreaGroupTypeId )

        IF @ServingGroupTypeId IS NOT NULL
        BEGIN
            INSERT INTO [GroupTypeAssociation] ( [GroupTypeId], [ChildGroupTypeId] )
	        VALUES ( @VolunteerAreaGroupTypeId, @ServingGroupTypeId )

            -- Update the serving group type to inherit from new 'Check-in' group type
            UPDATE [GroupType] SET 
                [InheritedGroupTypeId] = @CheckInGroupTypeId,
                [AllowMultipleLocations] = 1
            WHERE [Id] = @ServingGroupTypeId
            AND [InheritedGroupTypeId] IS NULL
        END
    
    END

    -- Add a default 'Member' role to any group type that does not have any roles
    INSERT INTO [GroupTypeRole] ( [IsSystem], [GroupTypeId], [Name], [Description], [Order], [IsLeader], [Guid], [CanView], [CanEdit] )
    SELECT 0, [Id], 'Member', 'Member of group', 0, 0, NEWID(), 0, 0 
    FROM [GroupType] WHERE [Id] NOT IN (
        SELECT [GroupTypeId] FROM [GroupTypeRole]
    )

    -- Set the group type's default role to the newly created group type role
	UPDATE T SET [DefaultGroupRoleId] = R.[Id]
	FROM [GroupType] T
	INNER JOIN [GroupTypeRole] R ON R.[GroupTypeId] = T.[Id] AND R.[Name] = 'Member'
	WHERE T.[DefaultGroupRoleId] IS NULL

");
        }
        /// <summary>
        /// Operations to be performed during the upgrade process.
        /// </summary>
        public override void Up()
        {
            RockMigrationHelper.AddGroupType("Service Attendance", "Used for tracking the attendance for people who attend the 'weekend' or 'weekly' service.", "Group", "Member", false, false, false, "fa fa-walking", 0, null, 0, "4A406CB0-495B-4795-B788-52BDFDE00B01", "77713830-AE5E-4B1A-94FA-E145DFF85035", true);
            Sql(string.Format(@"
                DECLARE @GroupTypeId INT = (SELECT [Id] FROM [GroupType] WHERE [Guid]='77713830-AE5E-4B1A-94FA-E145DFF85035')

                UPDATE
                    [GroupType]
                SET [AttendanceCountsAsWeekendService] = 1,
                    [GroupViewLavaTemplate] = '{0}'
                WHERE [Id] = @GroupTypeId

                DECLARE @AttributeId INT = (SELECT [Id] FROM [Attribute] WHERE [Key]='core_checkin_PreventDuplicateCheckin')

                IF NOT EXISTS(SELECT [Id] FROM [dbo].[AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @GroupTypeId)
                                BEGIN
                                    INSERT INTO [AttributeValue] (
                                          [IsSystem]
		                                , [AttributeId]
		                                , [EntityId]
		                                , [Value]
		                                , [Guid])
                                    VALUES(
                                          1
		                                , @AttributeId
		                                , @GroupTypeId
		                                , 'True'
		                                , 'A27A7E68-7FBA-4648-B71D-FAA324752850')
                                END
", new GroupType().GroupViewLavaTemplate.Replace("'", "''")));
            RockMigrationHelper.AddGroupType("Services", "", "Group", "Member", true, false, false, "", 0, "6E7AD783-7614-4721-ABC1-35842113EF59", 0, null, "235BAE2B-5760-4763-AADF-3938F34BA100", true);

            Sql(string.Format(@"
    DECLARE @AttendanceServiceGroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '77713830-AE5E-4B1A-94FA-E145DFF85035' )
    DECLARE @ServicesGroupTypeId int = ( SELECT TOP 1 [Id] FROM [GroupType] WHERE [Guid] = '235BAE2B-5760-4763-AADF-3938F34BA100' )
        IF @ServicesGroupTypeId IS NOT NULL
        BEGIN
            INSERT INTO [GroupTypeAssociation] ( [GroupTypeId], [ChildGroupTypeId] )
	        VALUES ( @AttendanceServiceGroupTypeId, @ServicesGroupTypeId )
        END

   -- Set AttendanceCountsAsWeekendService to true for Services
      UPDATE
           [GroupType]
      SET [AttendanceCountsAsWeekendService] = 1,[GroupViewLavaTemplate] = '{0}'
      WHERE [Id] = @ServicesGroupTypeId

    -- Add a default 'Member' role to any group type that does not have any roles
    INSERT INTO [GroupTypeRole] ( [IsSystem], [GroupTypeId], [Name], [Description], [Order], [IsLeader], [Guid], [CanView], [CanEdit] )
    SELECT 0, [Id], 'Member', 'Member of group', 0, 0, NEWID(), 0, 0 
    FROM [GroupType] WHERE [Id] NOT IN (
        SELECT [GroupTypeId] FROM [GroupTypeRole]
    )
    -- Set the group type's default role to the newly created group type role
	UPDATE T SET [DefaultGroupRoleId] = R.[Id]
	FROM [GroupType] T
	INNER JOIN [GroupTypeRole] R ON R.[GroupTypeId] = T.[Id] AND R.[Name] = 'Member'
	WHERE T.[DefaultGroupRoleId] IS NULL

    --Add Weekend Service Group
    DECLARE @GroupTypeId INT = (SELECT [Id] FROM [GroupType] WHERE [Guid]='235BAE2B-5760-4763-AADF-3938F34BA100')

    INSERT INTO
	     [Group]
     ([GroupTypeId], [Name],[IsSystem],[IsActive],[IsSecurityRole], [Guid], [IsPublic],[Order])
    VALUES        (@GroupTypeId,'Weekend Service',1,1,0,'E000800B-B358-416F-BCD5-90C4CAC65AA3',1,0)

    --Add Weekend Service Group Locations
    DECLARE @GroupId INT = (SELECT [Id] FROM [Group] WHERE [Guid]='E000800B-B358-416F-BCD5-90C4CAC65AA3')
    IF @GroupId IS NOT NULL
    BEGIN
        INSERT INTO [GroupLocation]
        ([LocationId],[GroupId],[IsMailingLocation],[IsMappedLocation], [Guid])
        SELECT [LocationId], @GroupId, 0 , 0, NEWID()
        FROM [Campus] 
        WHERE [IsActive] = 1
        GROUP BY [LocationId] ORDER BY MAX([Name])
    END
", new GroupType().GroupViewLavaTemplate.Replace("'", "''")));
        }
Esempio n. 7
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()
        {
            // Attended Check-in Site
            RockMigrationHelper.AddSite("Rock Attended Check-in", "Attended Check-In Site.", "CheckinPark", AttendedCheckinSiteGuid);
            RockMigrationHelper.AddLayout(AttendedCheckinSiteGuid, "Checkin", "Checkin", "", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0");

            var cssHeaderLink     = "<link rel=\"stylesheet\" href=\"/Plugins/cc_newspring/AttendedCheckin/Styles/styles.css\">";
            var customSiteUpdates = @"UPDATE [Site] SET [IsSystem] = 0, [PageHeaderContent] = '{0}' WHERE [Guid] = '{1}'";

            Sql(string.Format(customSiteUpdates, cssHeaderLink, AttendedCheckinSiteGuid));

            // Attended Check-in root page (no blocks)
            RockMigrationHelper.AddPage("", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Attended Check-in", "Screens for managing Attended Check-in", "32A132A6-63A2-4840-B4A5-23D80994CCBD", "");
            Sql(@"
                DECLARE @PageId int = (SELECT [Id] FROM [Page] WHERE [Guid] = '32A132A6-63A2-4840-B4A5-23D80994CCBD')
                UPDATE [Site] SET [DefaultPageId] = @PageId WHERE [Guid] = '30FB46F7-4814-4691-852A-04FB56CC07F0'
            ");

            // Page: Admin
            RockMigrationHelper.AddPage("32A132A6-63A2-4840-B4A5-23D80994CCBD", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Admin", "Admin screen for Attended Check-in", "771E3CF1-63BD-4880-BC43-AC29B4CCE963", "");   // Site:Rock Attended Check-in
            RockMigrationHelper.AddPageRoute("771E3CF1-63BD-4880-BC43-AC29B4CCE963", "attendedcheckin");
            RockMigrationHelper.AddPageRoute("771E3CF1-63BD-4880-BC43-AC29B4CCE963", "attendedcheckin/admin");
            RockMigrationHelper.UpdateBlockType("Check-in Administration", "Check-In Administration block", "~/Plugins/cc_newspring/AttendedCheckIn/Admin.ascx", "Check-in > Attended", "2C51230E-BA2E-4646-BB10-817B26C16218");
            RockMigrationHelper.AddBlock("771E3CF1-63BD-4880-BC43-AC29B4CCE963", "", "2C51230E-BA2E-4646-BB10-817B26C16218", "Admin", "Main", "", "", 0, "9F8731AB-07DB-406F-A344-45E31D0DE301");
            RockMigrationHelper.AddBlockTypeAttribute("2C51230E-BA2E-4646-BB10-817B26C16218", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Previous Page", "PreviousPage", "", "", 0, @"", "B196160E-4397-4C6F-8C5A-317CAD3C118F");
            RockMigrationHelper.AddBlockTypeAttribute("2C51230E-BA2E-4646-BB10-817B26C16218", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Next Page", "NextPage", "", "", 0, @"", "7332D1F1-A1A5-48AE-BAB9-91C3AF085DB0");
            RockMigrationHelper.AddBlockTypeAttribute("2C51230E-BA2E-4646-BB10-817B26C16218", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "The workflow type to activate for check-in", 0, @"0", "18864DE7-F075-437D-BA72-A6054C209FA5");
            RockMigrationHelper.AddBlockTypeAttribute("2C51230E-BA2E-4646-BB10-817B26C16218", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Home Page", "HomePage", "", "", 0, @"", "40F39C36-3092-4B87-81F8-A9B1C6B261B2");
            RockMigrationHelper.AddBlockTypeAttribute("2C51230E-BA2E-4646-BB10-817B26C16218", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Time to Cache Kiosk GeoLocation", "TimetoCacheKioskGeoLocation", "", "Time in minutes to cache the coordinates of the kiosk. A value of zero (0) means cache forever. Default 20 minutes.", 1, @"20", "F5512AB9-CDE2-46F7-82A8-99168D7784B2");
            RockMigrationHelper.AddBlockAttributeValue("9F8731AB-07DB-406F-A344-45E31D0DE301", "B196160E-4397-4C6F-8C5A-317CAD3C118F", @"00000000-0000-0000-0000-000000000000");   // Previous Page
            RockMigrationHelper.AddBlockAttributeValue("9F8731AB-07DB-406F-A344-45E31D0DE301", "7332D1F1-A1A5-48AE-BAB9-91C3AF085DB0", @"8F618315-F554-4751-AB7F-00CC5658120A");   // Next Page
            RockMigrationHelper.AddBlockAttributeValue("9F8731AB-07DB-406F-A344-45E31D0DE301", "18864DE7-F075-437D-BA72-A6054C209FA5", @"6E8CD562-A1DA-4E13-A45C-853DB56E0014");   // Workflow Type
            RockMigrationHelper.AddBlockAttributeValue("9F8731AB-07DB-406F-A344-45E31D0DE301", "40F39C36-3092-4B87-81F8-A9B1C6B261B2", @"8F618315-F554-4751-AB7F-00CC5658120A");   // Home Page

            // Page: Search
            RockMigrationHelper.AddPage("32A132A6-63A2-4840-B4A5-23D80994CCBD", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Search", "Search screen for Attended Check-in", "8F618315-F554-4751-AB7F-00CC5658120A", "");   // Site:Rock Attended Check-in
            RockMigrationHelper.AddPageRoute("8F618315-F554-4751-AB7F-00CC5658120A", "attendedcheckin/search");
            RockMigrationHelper.UpdateBlockType("Family Select", "Attended Check-In Search block", "~/Plugins/cc_newspring/AttendedCheckIn/Search.ascx", "Check-in > Attended", "645D3F2F-0901-44FE-93E9-446DBC8A1680");
            RockMigrationHelper.AddBlock("8F618315-F554-4751-AB7F-00CC5658120A", "", "645D3F2F-0901-44FE-93E9-446DBC8A1680", "Search", "Main", "", "", 0, "182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Admin Page", "AdminPage", "", "", 0, @"", "BBB93FF9-C021-4E82-8C03-55942FA4141E");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Previous Page", "PreviousPage", "", "", 0, @"", "72E40960-2072-4F08-8EA8-5A766B49A2E0");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Next Page", "NextPage", "", "", 0, @"", "BF8AAB12-57A2-4F50-992C-428C5DDCB89B");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "The workflow type to activate for check-in", 0, @"0", "C4E992EA-62AE-4211-BE5A-9EEF5131235C");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Home Page", "HomePage", "", "", 0, @"", "EBE397EF-07FF-4B97-BFF3-152D139F9B80");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Maximum Text Length", "MaximumTextLength", "", "Maximum length for text searches (defaults to 20).", 0, @"20", "970A9BD6-D58A-4F8E-8B20-EECB845E6BD6");
            RockMigrationHelper.AddBlockTypeAttribute("645D3F2F-0901-44FE-93E9-446DBC8A1680", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Minimum Text Length", "MinimumTextLength", "", "Minimum length for text searches (defaults to 4).", 0, @"4", "09536DD6-8020-400F-856C-DF3BEA6F76C5");
            RockMigrationHelper.AddBlockAttributeValue("182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB", "BBB93FF9-C021-4E82-8C03-55942FA4141E", @"771E3CF1-63BD-4880-BC43-AC29B4CCE963");   // Admin Page
            RockMigrationHelper.AddBlockAttributeValue("182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB", "72E40960-2072-4F08-8EA8-5A766B49A2E0", @"BE996C9B-3DFE-407F-BD53-D6F58D85A035");   // Previous Page
            RockMigrationHelper.AddBlockAttributeValue("182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB", "BF8AAB12-57A2-4F50-992C-428C5DDCB89B", @"AF83D0B2-2995-4E46-B0DF-1A4763637A68");   // Next Page
            RockMigrationHelper.AddBlockAttributeValue("182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB", "C4E992EA-62AE-4211-BE5A-9EEF5131235C", @"6E8CD562-A1DA-4E13-A45C-853DB56E0014");   // Workflow Type
            RockMigrationHelper.AddBlockAttributeValue("182C9AA0-E76F-4AAF-9F61-5418EE5A0CDB", "EBE397EF-07FF-4B97-BFF3-152D139F9B80", @"8F618315-F554-4751-AB7F-00CC5658120A");   // Home Page

            // Page: Family Select
            RockMigrationHelper.AddPage("32A132A6-63A2-4840-B4A5-23D80994CCBD", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Family Select", "Family select for Attended Check-in", "AF83D0B2-2995-4E46-B0DF-1A4763637A68", "");   // Site:Rock Attended Check-in
            RockMigrationHelper.AddPageRoute("AF83D0B2-2995-4E46-B0DF-1A4763637A68", "attendedcheckin/family");
            RockMigrationHelper.UpdateBlockType("Family Select", "Attended Check-In Family Select Block", "~/Plugins/cc_newspring/AttendedCheckIn/FamilySelect.ascx", "Check-in > Attended", "4D48B5F0-F0B2-4C10-8498-DAF690761A80");
            RockMigrationHelper.AddBlock("AF83D0B2-2995-4E46-B0DF-1A4763637A68", "", "4D48B5F0-F0B2-4C10-8498-DAF690761A80", "Family Select", "Main", "", "", 0, "82929409-8551-413C-972A-98EDBC23F420");
            RockMigrationHelper.AddBlock("AF83D0B2-2995-4E46-B0DF-1A4763637A68", "", "49FC4B38-741E-4B0B-B395-7C1929340D88", "Idle Redirect", "Main", "", "", 1, "BDD502FF-40D2-42E6-845E-95C49C3505B3");
            RockMigrationHelper.AddBlockTypeAttribute("4D48B5F0-F0B2-4C10-8498-DAF690761A80", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Previous Page", "PreviousPage", "", "", 0, @"", "DD9F93C9-009B-4FA5-8FF9-B186E4969ACB");
            RockMigrationHelper.AddBlockTypeAttribute("4D48B5F0-F0B2-4C10-8498-DAF690761A80", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Next Page", "NextPage", "", "", 0, @"", "81A02B6F-F760-4110-839C-4507CF285A7E");
            RockMigrationHelper.AddBlockTypeAttribute("4D48B5F0-F0B2-4C10-8498-DAF690761A80", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "The workflow type to activate for check-in", 0, @"0", "338CAD91-3272-465B-B768-0AC2F07A0B40");
            RockMigrationHelper.AddBlockTypeAttribute("4D48B5F0-F0B2-4C10-8498-DAF690761A80", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Home Page", "HomePage", "", "", 0, @"", "2DF1D39B-DFC7-4FB2-B638-3D99C3C4F4DF");
            RockMigrationHelper.AddBlockAttributeValue("82929409-8551-413C-972A-98EDBC23F420", "DD9F93C9-009B-4FA5-8FF9-B186E4969ACB", @"8F618315-F554-4751-AB7F-00CC5658120A"); // Previous Page
            RockMigrationHelper.AddBlockAttributeValue("82929409-8551-413C-972A-98EDBC23F420", "81A02B6F-F760-4110-839C-4507CF285A7E", @"BE996C9B-3DFE-407F-BD53-D6F58D85A035"); // Next Page
            RockMigrationHelper.AddBlockAttributeValue("82929409-8551-413C-972A-98EDBC23F420", "338CAD91-3272-465B-B768-0AC2F07A0B40", @"6E8CD562-A1DA-4E13-A45C-853DB56E0014"); // Workflow Type
            RockMigrationHelper.AddBlockAttributeValue("82929409-8551-413C-972A-98EDBC23F420", "2DF1D39B-DFC7-4FB2-B638-3D99C3C4F4DF", @"8F618315-F554-4751-AB7F-00CC5658120A"); // Home Page
            RockMigrationHelper.AddBlockAttributeValue("BDD502FF-40D2-42E6-845E-95C49C3505B3", "2254B67B-9CB1-47DE-A63D-D0B56051ECD4", @"~/attendedcheckin/search");             // New Location
            RockMigrationHelper.AddBlockAttributeValue("BDD502FF-40D2-42E6-845E-95C49C3505B3", "1CAC7B16-041A-4F40-8AEE-A39DFA076C14", @"180");                                  // Idle Seconds

            // Page: Confirmation
            RockMigrationHelper.AddPage("32A132A6-63A2-4840-B4A5-23D80994CCBD", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Confirmation", "Confirmation screen for Attended Check-in", "BE996C9B-3DFE-407F-BD53-D6F58D85A035", "");   // Site:Rock Attended Check-in
            RockMigrationHelper.AddPageRoute("BE996C9B-3DFE-407F-BD53-D6F58D85A035", "attendedcheckin/confirm");
            RockMigrationHelper.UpdateBlockType("Confirmation Block", "Attended Check-In Confirmation Block", "~/Plugins/cc_newspring/AttendedCheckIn/Confirm.ascx", "Check-in > Attended", "5B1D4187-9B34-4AB6-AC57-7E2CF67B266F");
            RockMigrationHelper.AddBlock("BE996C9B-3DFE-407F-BD53-D6F58D85A035", "", "5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "Confirmation", "Main", "", "", 0, "7CC68DD4-A6EF-4B67-9FEA-A144C479E058");
            RockMigrationHelper.AddBlock("BE996C9B-3DFE-407F-BD53-D6F58D85A035", "", "49FC4B38-741E-4B0B-B395-7C1929340D88", "Idle Redirect", "Main", "", "", 1, "FAEC5FCC-B850-4DA6-8844-715159D39BD5");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Previous Page", "PreviousPage", "", "", 0, @"", "E45D2B10-D1B1-4CBE-9C7A-3098B1D95F47");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Next Page", "NextPage", "", "", 0, @"", "48813610-DD26-4E72-9D19-817535802C49");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "The workflow type to activate for check-in", 0, @"0", "2A71729F-E7CA-4ACD-9996-A6A661A069FD");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Home Page", "HomePage", "", "", 0, @"", "DEB23724-94F9-4164-BFAB-AD2DDE1F90ED");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Activity Select Page", "ActivitySelectPage", "", "", 0, @"", "2D54A2C9-759C-45B6-8E23-42F39E134170");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Print Individual Labels", "PrintIndividualLabels", "", "", 0, @"False", "FB49557F-4B8E-4F7B-ACE1-A4230C3BB832");
            RockMigrationHelper.AddBlockTypeAttribute("5B1D4187-9B34-4AB6-AC57-7E2CF67B266F", "9C204CD0-1233-41C5-818A-C5DA439445AA", "Workflow Activity", "WorkflowActivity", "", "The name of the workflow activity to run on selection.", 0, @"", "2D44DDDC-F0DD-49E1-8A56-7D8B979D9C67");
            RockMigrationHelper.AddBlockAttributeValue("7CC68DD4-A6EF-4B67-9FEA-A144C479E058", "E45D2B10-D1B1-4CBE-9C7A-3098B1D95F47", @"AF83D0B2-2995-4E46-B0DF-1A4763637A68"); // Previous Page
            RockMigrationHelper.AddBlockAttributeValue("7CC68DD4-A6EF-4B67-9FEA-A144C479E058", "48813610-DD26-4E72-9D19-817535802C49", @"8F618315-F554-4751-AB7F-00CC5658120A"); // Next Page
            RockMigrationHelper.AddBlockAttributeValue("7CC68DD4-A6EF-4B67-9FEA-A144C479E058", "2A71729F-E7CA-4ACD-9996-A6A661A069FD", @"6E8CD562-A1DA-4E13-A45C-853DB56E0014"); // Workflow Type
            RockMigrationHelper.AddBlockAttributeValue("7CC68DD4-A6EF-4B67-9FEA-A144C479E058", "DEB23724-94F9-4164-BFAB-AD2DDE1F90ED", @"8F618315-F554-4751-AB7F-00CC5658120A"); // Home Page
            RockMigrationHelper.AddBlockAttributeValue("7CC68DD4-A6EF-4B67-9FEA-A144C479E058", "2D54A2C9-759C-45B6-8E23-42F39E134170", @"C87916FE-417E-4A11-8831-5CFA7678A228"); // Activity Select Page
            RockMigrationHelper.AddBlockAttributeValue("FAEC5FCC-B850-4DA6-8844-715159D39BD5", "2254B67B-9CB1-47DE-A63D-D0B56051ECD4", @"~/attendedcheckin/search");             // New Location
            RockMigrationHelper.AddBlockAttributeValue("FAEC5FCC-B850-4DA6-8844-715159D39BD5", "1CAC7B16-041A-4F40-8AEE-A39DFA076C14", @"180");                                  // Idle Seconds

            // Page: Activity Select
            RockMigrationHelper.AddPage("32A132A6-63A2-4840-B4A5-23D80994CCBD", "3BD6CFC1-0BF2-43C8-AD38-44E711D6ACE0", "Activity Select", "Activity select for Attended Check-in", "C87916FE-417E-4A11-8831-5CFA7678A228", "");   // Site:Rock Attended Check-in
            RockMigrationHelper.AddPageRoute("C87916FE-417E-4A11-8831-5CFA7678A228", "attendedcheckin/activity");
            RockMigrationHelper.UpdateBlockType("Activity Select", "Attended Check-In Activity Select Block", "~/Plugins/cc_newspring/AttendedCheckIn/ActivitySelect.ascx", "Check-in > Attended", "78E2AB4A-FDF7-4864-92F7-F052050BC4BB");
            RockMigrationHelper.AddBlock("C87916FE-417E-4A11-8831-5CFA7678A228", "", "78E2AB4A-FDF7-4864-92F7-F052050BC4BB", "Activity Select", "Main", "", "", 0, "8C8CBBE9-2502-4FEC-804D-C0DA13C07FA4");
            RockMigrationHelper.AddBlockTypeAttribute("78E2AB4A-FDF7-4864-92F7-F052050BC4BB", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Previous Page", "PreviousPage", "", "", 0, @"", "6048A23D-6544-441A-A8B3-5782CAF5B468");
            RockMigrationHelper.AddBlockTypeAttribute("78E2AB4A-FDF7-4864-92F7-F052050BC4BB", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Next Page", "NextPage", "", "", 0, @"", "39008E18-48C9-445F-B9D7-78334B76A7EE");
            RockMigrationHelper.AddBlockTypeAttribute("78E2AB4A-FDF7-4864-92F7-F052050BC4BB", "46A03F59-55D3-4ACE-ADD5-B4642225DD20", "Workflow Type", "WorkflowType", "", "The workflow type to activate for check-in", 0, @"0", "BEC10B87-4B19-4CD5-8952-A4D59DDA3E9C");
            RockMigrationHelper.AddBlockTypeAttribute("78E2AB4A-FDF7-4864-92F7-F052050BC4BB", "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108", "Home Page", "HomePage", "", "", 0, @"", "5046A353-D901-45BB-9981-9CC1B33550C6");
            RockMigrationHelper.AddBlockAttributeValue("8C8CBBE9-2502-4FEC-804D-C0DA13C07FA4", "6048A23D-6544-441A-A8B3-5782CAF5B468", @"BE996C9B-3DFE-407F-BD53-D6F58D85A035"); // Previous Page
            RockMigrationHelper.AddBlockAttributeValue("8C8CBBE9-2502-4FEC-804D-C0DA13C07FA4", "39008E18-48C9-445F-B9D7-78334B76A7EE", @"BE996C9B-3DFE-407F-BD53-D6F58D85A035"); // Next Page
            RockMigrationHelper.AddBlockAttributeValue("8C8CBBE9-2502-4FEC-804D-C0DA13C07FA4", "BEC10B87-4B19-4CD5-8952-A4D59DDA3E9C", @"6E8CD562-A1DA-4E13-A45C-853DB56E0014"); // Workflow Type
            RockMigrationHelper.AddBlockAttributeValue("8C8CBBE9-2502-4FEC-804D-C0DA13C07FA4", "5046A353-D901-45BB-9981-9CC1B33550C6", @"8F618315-F554-4751-AB7F-00CC5658120A"); // Home Page
            RockMigrationHelper.AddBlock("C87916FE-417E-4A11-8831-5CFA7678A228", "", "49FC4B38-741E-4B0B-B395-7C1929340D88", "Idle Redirect", "Main", "", "", 1, "31E6A1CC-2ABE-4ECC-B8DF-1FD2E8EBA203");
            RockMigrationHelper.AddBlockAttributeValue("31E6A1CC-2ABE-4ECC-B8DF-1FD2E8EBA203", "2254B67B-9CB1-47DE-A63D-D0B56051ECD4", @"~/attendedcheckin/search");             // New Location
            RockMigrationHelper.AddBlockAttributeValue("31E6A1CC-2ABE-4ECC-B8DF-1FD2E8EBA203", "1CAC7B16-041A-4F40-8AEE-A39DFA076C14", @"180");                                  // Idle Seconds

            // Custom workflow actions
            RockMigrationHelper.UpdateEntityType("cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.FilterGroupsByGender", "Filter Groups By Gender", "cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.FilterGroupsByGender", false, true, "DC7DB1FD-8CC8-4AC4-B0A5-B5F85FF03540");
            RockMigrationHelper.UpdateEntityType("cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByBestFit", "Select By Best Fit", "cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByBestFit", false, true, "B1A855F8-7ED6-49AE-8EEA-D1DCB6C7E944");
            RockMigrationHelper.UpdateEntityType("cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByLastAttended", "Select By Last Attended", "cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByLastAttended", false, true, "B4E27263-BB68-46DB-9876-D0E8C26449A3");
            RockMigrationHelper.UpdateEntityType("cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByMultipleAttended", "Select By Multiple Attended", "cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByMultipleAttended", false, true, "DDC2D0CA-28A9-420B-9915-B3831DE75DAC");

            // Set attribute defaults
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.FilterGroupsByAge:Order
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("23F1E3FD-48AE-451F-9911-A5C7523A74B6", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "554108CF-31A1-47C0-A184-18B4A881D7FD");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.FilterGroupsByAge:Active
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("23F1E3FD-48AE-451F-9911-A5C7523A74B6", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "6F98731B-1C17-49F0-8B5C-1C7DBDB08A07");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.FilterGroupsByAge:Remove
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("23F1E3FD-48AE-451F-9911-A5C7523A74B6", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Remove", "Remove", "Select 'Yes' if groups should be be removed.  Select 'No' if they should just be marked as excluded.", 0, @"False", "F05781E2-3517-4D20-A3BB-DA56CA025F25");

            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Active - false
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("F940F6E5-6784-4925-8DF6-E59A911FDCBE", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "184D2EF3-247C-4C1F-93D6-49474CA95300");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Order - false
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("F940F6E5-6784-4925-8DF6-E59A911FDCBE", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "5F0C8E93-AB70-4508-999D-C5492E2ECADA");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Remove - false
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("F940F6E5-6784-4925-8DF6-E59A911FDCBE", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Remove", "Remove", "Select 'Yes' if groups should be be removed.  Select 'No' if they should just be marked as excluded.", 0, @"False", "F699D995-51EC-4EF7-8A03-B41D7C16A3C2");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:RemoveNonSN - false
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("F940F6E5-6784-4925-8DF6-E59A911FDCBE", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Remove (or exclude) Non-Special Needs Groups", "RemoveNonSpecialNeedsGroups", "If set to true, non-special-needs groups will be removed if the person has special needs. This basically prevents special needs kids from getting put into regular classes. Default false.", 0, @"False", "2F00F31C-2042-43ED-BEB6-C051CA92DAC8");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:RemoveSN - false
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("F940F6E5-6784-4925-8DF6-E59A911FDCBE", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Remove (or exclude) Special Needs Groups", "RemoveSpecialNeedsGroups", "If set to true, special-needs groups will be removed if the person is NOT special needs. This basically prevents non-special-needs kids from getting put into special needs classes. Default true.", 0, @"True", "9F72C20F-B927-4777-93A1-1EFEB8453960");

            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByBestFit:Active
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("B1A855F8-7ED6-49AE-8EEA-D1DCB6C7E944", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "83F299E7-F2C9-4F0A-BA51-23D6CD0F9433");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByBestFit:Order
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("B1A855F8-7ED6-49AE-8EEA-D1DCB6C7E944", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "C599F69C-7295-4F82-A9A2-C769DBAF8765");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByLastAttended:Active
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("B4E27263-BB68-46DB-9876-D0E8C26449A3", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "8A1DBF48-1BF8-4EB8-9CDD-2D3773DD64EA");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByLastAttended:Order
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("B4E27263-BB68-46DB-9876-D0E8C26449A3", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "99840778-A814-4826-A976-46CC01CC2335");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByMultipleAttended:Active
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("DDC2D0CA-28A9-420B-9915-B3831DE75DAC", "1EDAFDED-DFE6-4334-B019-6EECBA89E05A", "Active", "Active", "Should Service be used?", 0, @"False", "85BB0E2E-A8DE-4991-B92C-D6378F60001D");
            // cc.newspring.AttendedCheckIn.Workflow.Action.CheckIn.SelectByMultipleAttended:Order
            RockMigrationHelper.UpdateWorkflowActionEntityAttribute("DDC2D0CA-28A9-420B-9915-B3831DE75DAC", "A75DFC58-7A1B-4799-BF31-451B2BBE38FF", "Order", "Order", "The order that this service should be used (priority)", 0, @"", "7237CFF5-BC59-4C2C-8314-F690038D93F8");

            // Attended Workflow Type
            RockMigrationHelper.UpdateWorkflowType(false, true, "Attended Check-in", "Workflow for managing attended check-in", "8F8B272D-D351-485E-86D6-3EE5B7C84D99", "Check-in", "fa fa-list-ol", 0, false, 3, "6E8CD562-A1DA-4E13-A45C-853DB56E0014"); // Attended Check-in
            RockMigrationHelper.UpdateWorkflowActivityType("6E8CD562-A1DA-4E13-A45C-853DB56E0014", true, "Family Search", "", false, 0, "B6FC7350-10E0-4255-873D-4B492B7D27FF");                                                                           // Attended Check-in:Family Search
            RockMigrationHelper.UpdateWorkflowActivityType("6E8CD562-A1DA-4E13-A45C-853DB56E0014", true, "Person Search", "", false, 1, "6D8CC755-0140-439A-B5A3-97D2F7681697");                                                                           // Attended Check-in:Person Search
            RockMigrationHelper.UpdateWorkflowActivityType("6E8CD562-A1DA-4E13-A45C-853DB56E0014", true, "Activity Search", "", false, 2, "77CCAF74-AC78-45DE-8BF9-4C544B54C9DD");                                                                         // Attended Check-in:Activity Search
            RockMigrationHelper.UpdateWorkflowActivityType("6E8CD562-A1DA-4E13-A45C-853DB56E0014", true, "Save Attendance", "", false, 3, "BF4E1CAA-25A3-4676-BCA2-FDE2C07E8210");                                                                         // Attended Check-in:Save Attendance
            RockMigrationHelper.UpdateWorkflowActivityType("6E8CD562-A1DA-4E13-A45C-853DB56E0014", true, "Create Labels", "", false, 4, "21245E72-E914-4581-972E-06DD171DCE6A");                                                                           // Attended Check-in:Create Labels

            // Family Search
            // Attended Check-in:Family Search:Find Families
            RockMigrationHelper.UpdateWorkflowActionType("B6FC7350-10E0-4255-873D-4B492B7D27FF", "Find Families", 0, "E2F172A8-88E5-4F84-9805-73164516F5FB", true, false, "", "", 1, "", "A7690077-CCB7-4AB2-A945-7BEE4861AF9E");

            // Person Search
            // Attended Check-in:Person Search:Find Family Members
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Find Family Members", 0, "5794B18B-8F43-43B2-8D60-6C047AB096AF", true, false, "", "", 1, "", "62D775D6-0689-43F9-AA16-858B77FAB87C");
            // Attended Check-in:Person Search:Find Relationships
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Find Relationships", 1, "F43099A7-E872-439B-A750-351C741BCFEF", true, false, "", "", 1, "", "50019BF6-EF27-4F9B-A06F-6A185B5CBD39");
            // Attended Check-in:Person Search:Load Group Types
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Load Group Types", 2, "50D5D915-074A-41FB-9EA7-0DBE52141398", true, false, "", "", 1, "", "05DD1385-B984-4905-8EA2-3B35EAC35B99");
            // Attended Check-in:Activity Search:Load Groups
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Load Groups", 3, "008402A8-3A6C-4CB6-A230-6AD532505EDC", true, false, "", "", 1, "", "9DFD5255-CC94-4B88-AE2E-2FC32F35D9D9");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Filter Groups By Special Needs", 4, "F940F6E5-6784-4925-8DF6-E59A911FDCBE", true, false, "", "", 1, "", "ED2150E5-6B9E-4266-B0FA-9C6836C0DC20");
            // Attended Check-in:Activity Search:Filter Groups By Grade
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Filter Groups By Grade", 5, "542DFBF4-F2F5-4C2F-9C9D-CDB00FDD5F04", true, false, "", "", 1, "", "C250DB16-03C5-45C9-B70B-7A0DE7D5550E");
            // Attended Check-in:Activity Search:Filter Groups By Age
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Filter Groups By Age", 6, "23F1E3FD-48AE-451F-9911-A5C7523A74B6", true, false, "", "", 1, "", "5F4CAF8E-AB49-409C-8831-845A51298A26");
            // Attended Check-in:Activity Search:Remove Empty Group Types
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Remove Empty Group Types", 7, "E998B9A7-31C9-46F6-B91C-4E5C3F06C82F", true, false, "", "", 1, "", "9089B47B-B441-41DE-84A7-710F4E3E55EF");
            // Attended Check-in:Person Search:Remove Empty People
            RockMigrationHelper.UpdateWorkflowActionType("6D8CC755-0140-439A-B5A3-97D2F7681697", "Remove Empty People", 8, "B8B72812-190E-4802-A63F-E693344754BD", true, false, "", "", 1, "", "1813C89A-623C-4234-91D4-3243CA68CD03");

            // Activity Search
            // Attended Check-in:Activity Search:Load Locations
            RockMigrationHelper.UpdateWorkflowActionType("77CCAF74-AC78-45DE-8BF9-4C544B54C9DD", "Load Locations", 1, "4492E36A-77C8-4DC7-8128-570FAA161ADB", true, false, "", "", 1, "", "1F342433-CE63-4FB4-88CE-00A8306ECED8");
            // Attended Check-in:Activity Search:Filter Active Locations
            RockMigrationHelper.UpdateWorkflowActionType("77CCAF74-AC78-45DE-8BF9-4C544B54C9DD", "Filter Active Locations", 2, "7BB371F9-A8DE-49D3-BEEA-C191F6C7D4A0", true, false, "", "", 1, "", "685CB9D2-EAA3-4322-81E3-289BFCAE15E7");
            // Attended Check-in:Activity Search:Load Schedules
            RockMigrationHelper.UpdateWorkflowActionType("77CCAF74-AC78-45DE-8BF9-4C544B54C9DD", "Load Schedules", 3, "24A7E196-B50B-4BD6-A347-07CFC5ABEF9E", true, false, "", "", 1, "", "5CD01782-54F7-405D-B857-73BDE9242761");
            // Attended Check-in:Activity Search:Select By Multiple Attended
            RockMigrationHelper.UpdateWorkflowActionType("77CCAF74-AC78-45DE-8BF9-4C544B54C9DD", "Select By Multiple Attended", 4, "DDC2D0CA-28A9-420B-9915-B3831DE75DAC", true, false, "", "", 1, "", "32CFAB16-629D-490C-A2C4-A95731BA5931");
            // Attended Check-in:Activity Search:Select By Best Fit
            RockMigrationHelper.UpdateWorkflowActionType("77CCAF74-AC78-45DE-8BF9-4C544B54C9DD", "Select By Best Fit", 5, "B1A855F8-7ED6-49AE-8EEA-D1DCB6C7E944", true, false, "", "", 1, "", "7D482C58-34CB-4414-9607-4BD01D0C217A");

            // Save Attendance
            // Attended Check-in:Save Attendance:Save Attendance
            RockMigrationHelper.UpdateWorkflowActionType("BF4E1CAA-25A3-4676-BCA2-FDE2C07E8210", "Save Attendance", 0, "50B2FEE6-DB7A-43C0-9DCF-19F61CD02BC6", true, false, "", "", 1, "", "93AF3357-7AE9-47AA-8B8B-C5351490E1ED");

            // Attended Check-in:Save Attendance:Create Labels
            RockMigrationHelper.UpdateWorkflowActionType("21245E72-E914-4581-972E-06DD171DCE6A", "Create Labels", 0, "8F348E7B-F9FD-4600-852D-477B13B0B4EE", true, false, "", "", 1, "", "BBE6E76D-6C8E-4B8E-931C-DD3CBE9619A4");

            // Set attribute values
            // Attended Check-in:Family Search:Find Families:Order
            RockMigrationHelper.AddActionTypeAttributeValue("A7690077-CCB7-4AB2-A945-7BEE4861AF9E", "3404112D-3A97-4AE8-B699-07F62BD37D81", @"");
            // Attended Check-in:Family Search:Find Families:Active
            RockMigrationHelper.AddActionTypeAttributeValue("A7690077-CCB7-4AB2-A945-7BEE4861AF9E", "1C6D8BD4-1A72-41E7-A9B5-AF37613058D8", @"False");
            // Attended Check-in:Person Search:Find Family Members:Order
            RockMigrationHelper.AddActionTypeAttributeValue("62D775D6-0689-43F9-AA16-858B77FAB87C", "857A277E-6824-48FA-8E7A-9988AC4BCB13", @"");
            // Attended Check-in:Person Search:Find Family Members:Active
            RockMigrationHelper.AddActionTypeAttributeValue("62D775D6-0689-43F9-AA16-858B77FAB87C", "3EF34D41-030B-411F-9D18-D331ABD89F0D", @"False");
            // Attended Check-in:Person Search:Find Relationships:Order
            RockMigrationHelper.AddActionTypeAttributeValue("50019BF6-EF27-4F9B-A06F-6A185B5CBD39", "2C5535C6-80C9-4886-9A93-33A18F46AAA3", @"");
            // Attended Check-in:Person Search:Find Relationships:Active
            RockMigrationHelper.AddActionTypeAttributeValue("50019BF6-EF27-4F9B-A06F-6A185B5CBD39", "6845038E-A08E-4D0A-BE1C-750034109496", @"False");
            // Attended Check-in:Person Search:Load Group Types:Order
            RockMigrationHelper.AddActionTypeAttributeValue("05DD1385-B984-4905-8EA2-3B35EAC35B99", "1F4BD3F6-C528-4160-8478-825C3B8AC85D", @"");
            // Attended Check-in:Person Search:Load Group Types:Active
            RockMigrationHelper.AddActionTypeAttributeValue("05DD1385-B984-4905-8EA2-3B35EAC35B99", "1C7CD28E-ACC5-4B88-BC05-E02D72919305", @"False");
            // Attended Check-in:Person Search:Filter Groups by Age:Order
            RockMigrationHelper.AddActionTypeAttributeValue("5F4CAF8E-AB49-409C-8831-845A51298A26", "554108CF-31A1-47C0-A184-18B4A881D7FD", @"");
            // Attended Check-in:Person Search:Filter Groups by Age:Active
            RockMigrationHelper.AddActionTypeAttributeValue("5F4CAF8E-AB49-409C-8831-845A51298A26", "6F98731B-1C17-49F0-8B5C-1C7DBDB08A07", @"False");
            // Attended Check-in:Person Search:Filter Groups by Age:Remove
            RockMigrationHelper.AddActionTypeAttributeValue("5F4CAF8E-AB49-409C-8831-845A51298A26", "F05781E2-3517-4D20-A3BB-DA56CA025F25", @"False");
            // Attended Check-in:Person Search:Remove Empty People:Order
            RockMigrationHelper.AddActionTypeAttributeValue("1813C89A-623C-4234-91D4-3243CA68CD03", "CFDAD883-5FAA-4EC6-B308-30BBB2EFAA94", @"");
            // Attended Check-in:Person Search:Remove Empty People:Active
            RockMigrationHelper.AddActionTypeAttributeValue("1813C89A-623C-4234-91D4-3243CA68CD03", "EE892293-5B1E-4631-877E-179849F8D0FC", @"False");
            // Attended Check-in:Activity Search:Load Groups:Order
            RockMigrationHelper.AddActionTypeAttributeValue("9DFD5255-CC94-4B88-AE2E-2FC32F35D9D9", "C26C5959-7144-443B-88ED-28E4A5AE544C", @"");
            // Attended Check-in:Activity Search:Load Groups:Active
            RockMigrationHelper.AddActionTypeAttributeValue("9DFD5255-CC94-4B88-AE2E-2FC32F35D9D9", "AD7528AD-2A3D-4C26-B452-FA9F4F48953C", @"False");
            // Attended Check-in:Activity Search:Load Groups:Load All
            RockMigrationHelper.AddActionTypeAttributeValue("9DFD5255-CC94-4B88-AE2E-2FC32F35D9D9", "39762EF0-91D5-4B13-BD34-FC3AC3C24897", @"True");
            // Attended Check-in:Activity Search:Load Locations:Load All
            RockMigrationHelper.AddActionTypeAttributeValue("1F342433-CE63-4FB4-88CE-00A8306ECED8", "70203A96-AE70-47AD-A086-FD84792DF2B6", @"True");
            // Attended Check-in:Activity Search:Load Locations:Order
            RockMigrationHelper.AddActionTypeAttributeValue("1F342433-CE63-4FB4-88CE-00A8306ECED8", "6EE6128C-79BF-4333-85DB-3B0C92B27131", @"");
            // Attended Check-in:Activity Search:Load Locations:Active
            RockMigrationHelper.AddActionTypeAttributeValue("1F342433-CE63-4FB4-88CE-00A8306ECED8", "2F3B6B42-A89C-443A-9008-E9E96535E815", @"False");
            // Attended Check-in:Activity Search:Load Schedules:Order
            RockMigrationHelper.AddActionTypeAttributeValue("5CD01782-54F7-405D-B857-73BDE9242761", "F7B09469-EB3D-44A4-AB8E-C74318BD4669", @"");
            // Attended Check-in:Activity Search:Load Schedules:Active
            RockMigrationHelper.AddActionTypeAttributeValue("5CD01782-54F7-405D-B857-73BDE9242761", "4DFA9F8D-F2E6-4040-A23B-2A1F8258C767", @"False");
            // Attended Check-in:Activity Search:Load Schedules:Load All
            RockMigrationHelper.AddActionTypeAttributeValue("5CD01782-54F7-405D-B857-73BDE9242761", "B222CAF2-DF12-433C-B5D4-A8DB95B60207", @"True");
            // Attended Check-in:Activity Search:Filter Active Locations:Order
            RockMigrationHelper.AddActionTypeAttributeValue("685CB9D2-EAA3-4322-81E3-289BFCAE15E7", "C8BE5BB1-9293-4FA0-B4CF-FED19B855465", @"");
            // Attended Check-in:Activity Search:Filter Active Locations:Active
            RockMigrationHelper.AddActionTypeAttributeValue("685CB9D2-EAA3-4322-81E3-289BFCAE15E7", "D6BCB113-0699-4D58-8002-BC919CB4BA04", @"False");
            // Attended Check-in:Activity Search:Filter Active Locations:Remove
            RockMigrationHelper.AddActionTypeAttributeValue("685CB9D2-EAA3-4322-81E3-289BFCAE15E7", "885D28C5-A395-4A05-AEFB-6131498BDF12", @"True");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Active - false
            RockMigrationHelper.AddActionTypeAttributeValue("ED2150E5-6B9E-4266-B0FA-9C6836C0DC20", "184D2EF3-247C-4C1F-93D6-49474CA95300", @"False");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Order - false
            RockMigrationHelper.AddActionTypeAttributeValue("ED2150E5-6B9E-4266-B0FA-9C6836C0DC20", "5F0C8E93-AB70-4508-999D-C5492E2ECADA", @"");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:Remove - false
            RockMigrationHelper.AddActionTypeAttributeValue("ED2150E5-6B9E-4266-B0FA-9C6836C0DC20", "F699D995-51EC-4EF7-8A03-B41D7C16A3C2", @"False");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:RemoveNonSN - false
            RockMigrationHelper.AddActionTypeAttributeValue("ED2150E5-6B9E-4266-B0FA-9C6836C0DC20", "2F00F31C-2042-43ED-BEB6-C051CA92DAC8", @"False");
            // Attended Check-in:Activity Search:Filter Groups By Special Needs:RemoveSN - true
            RockMigrationHelper.AddActionTypeAttributeValue("ED2150E5-6B9E-4266-B0FA-9C6836C0DC20", "9F72C20F-B927-4777-93A1-1EFEB8453960", @"True");
            // Attended Check-in:Activity Search:Remove Empty Groups:Order
            RockMigrationHelper.AddActionTypeAttributeValue("9089B47B-B441-41DE-84A7-710F4E3E55EF", "041E4A2B-90C6-4242-A7F1-ED07D9B348F2", @"");
            // Attended Check-in:Activity Search:Remove Empty Groups:Active
            RockMigrationHelper.AddActionTypeAttributeValue("9089B47B-B441-41DE-84A7-710F4E3E55EF", "05C329B0-3794-42BD-9467-8F3FF95D7882", @"False");
            // Attended Check-in:Activity Search:Select By Multiple Attended:Order
            RockMigrationHelper.AddActionTypeAttributeValue("32CFAB16-629D-490C-A2C4-A95731BA5931", "99840778-A814-4826-A976-46CC01CC2335", @"");
            // Attended Check-in:Activity Search:Select By Multiple Attended:Active
            RockMigrationHelper.AddActionTypeAttributeValue("32CFAB16-629D-490C-A2C4-A95731BA5931", "8A1DBF48-1BF8-4EB8-9CDD-2D3773DD64EA", @"False");
            // Attended Check-in:Activity Search:Select By Best Fit:Order
            RockMigrationHelper.AddActionTypeAttributeValue("7D482C58-34CB-4414-9607-4BD01D0C217A", "C599F69C-7295-4F82-A9A2-C769DBAF8765", @"");
            // Attended Check-in:Activity Search:Select By Best Fit:Active
            RockMigrationHelper.AddActionTypeAttributeValue("7D482C58-34CB-4414-9607-4BD01D0C217A", "83F299E7-F2C9-4F0A-BA51-23D6CD0F9433", @"False");
            // Attended Check-in:Save Attendance:Save Attendance:Security Code Length
            RockMigrationHelper.AddActionTypeAttributeValue("93AF3357-7AE9-47AA-8B8B-C5351490E1ED", "D57F42C9-E497-4FEE-8231-4FE2D13DC191", @"3");
            // Attended Check-in:Save Attendance:Save Attendance:Order
            RockMigrationHelper.AddActionTypeAttributeValue("93AF3357-7AE9-47AA-8B8B-C5351490E1ED", "3BDE9124-BB3F-4190-BECF-6510890649E4", @"");
            // Attended Check-in:Save Attendance:Save Attendance:Active
            RockMigrationHelper.AddActionTypeAttributeValue("93AF3357-7AE9-47AA-8B8B-C5351490E1ED", "72A6C0DB-39C0-475B-A8EF-15A5D70FFA40", @"False");
            // Attended Check-in:Save Attendance:Create Labels:Order
            RockMigrationHelper.AddActionTypeAttributeValue("BBE6E76D-6C8E-4B8E-931C-DD3CBE9619A4", "F70112C9-4D93-41B9-A3FB-1E7C866AACCF", @"");
            // Attended Check-in:Save Attendance:Create Labels:Active
            RockMigrationHelper.AddActionTypeAttributeValue("BBE6E76D-6C8E-4B8E-931C-DD3CBE9619A4", "36EB15CE-095C-41ED-9C0F-9EA345599D54", @"False");

            // Add special needs attribute
            Sql(string.Format(@"
                INSERT INTO [dbo].[Attribute] ( [IsSystem],[FieldTypeId],[EntityTypeId],[EntityTypeQualifierColumn],[EntityTypeQualifierValue],[Key],[Name],[Description],[Order]
                    ,[IsGridColumn],[IsMultiValue],[IsRequired],[DefaultValue],[Guid] )
                VALUES (
                    0
                    ,(SELECT [Id] FROM [FieldType] WHERE [Class] = 'Rock.Field.Types.SelectSingleFieldType')
                    ,(SELECT [Id] FROM [EntityType] WHERE [Name] = 'Rock.Model.Person')
                    ,''
                    ,''
                    ,'HasSpecialNeeds'
                    ,'Has Special Needs'
                    ,'Flag to indicate if special needs are present'
                    ,0
                    ,0
                    ,0
                    ,0
                    ,'False'
                    ,'{0}')", SpecialNeedsAttributeGuid));

            Sql(string.Format(@"
                INSERT AttributeQualifier (IsSystem, AttributeId, [Key], Value, [Guid])
                VALUES (
                    0
                    , (SELECT [Id] FROM [Attribute] WHERE [Guid] = '{0}')
                    , 'fieldtype'
                    , 'ddl'
                    , NEWID() )

				INSERT AttributeQualifier (IsSystem, AttributeId, [Key], Value, [Guid])
				VALUES(
                    0
                    , (SELECT [Id] FROM [Attribute] WHERE [Guid] = '{0}')
                    , 'values'
                    , 'Yes'
                    , NEWID() )", SpecialNeedsAttributeGuid));

            // Make special needs appear under childhood info category
            Sql(string.Format(@"
                INSERT INTO [AttributeCategory]
                   ([AttributeId]
                   ,[CategoryId])
                VALUES
                   ((SELECT [Id] FROM [Attribute] WHERE [Guid] = '{0}')
                   ,(SELECT [Id] FROM [Category] WHERE [Name] = 'Childhood Information'))
            ", SpecialNeedsAttributeGuid));

            RockMigrationHelper.AddGroupType("Check in By Special Needs", "", "Group", "Member", false, true, true, "", 0, "0572A5FE-20A4-4BF1-95CD-C71DB5281392", 0, "6BCED84C-69AD-4F5A-9197-5C0F9C02DD34", "2CB16E13-141F-419F-BACD-8283AB6B3299", false);
            RockMigrationHelper.AddGroupTypeRole("2CB16E13-141F-419F-BACD-8283AB6B3299", "Member", "", 0, null, null, "4DC318F0-5E6F-4F34-B3C5-08264B6DFD29", false);
        }
        public override void Up()
        {
            RockMigrationHelper.AddGroupType("Acme Certificates",
                                             "Contains information on Acme SSL Certificates that are installed and will be renewed.",
                                             "Certificate", "Member", false, false, false, "fa fa-certificate", 999,
                                             null, 0, null, SystemGuid.GroupType.ACME_CERTIFICATES);
            int groupTypeId = ( int )SqlScalar("SELECT [Id] FROM [GroupType] WHERE [Guid] = @Guid", "@Guid", SystemGuid.GroupType.ACME_CERTIFICATES);

            RockMigrationHelper.AddEntityAttribute("Rock.Model.GroupType",
                                                   Rock.SystemGuid.FieldType.TEXT, "Id", groupTypeId.ToString(),
                                                   "Account", string.Empty, string.Empty, 0,
                                                   string.Empty, SystemGuid.Attribute.ACCOUNT);

            RockMigrationHelper.AddGroupTypeGroupAttribute(SystemGuid.GroupType.ACME_CERTIFICATES,
                                                           Rock.SystemGuid.FieldType.TEXT, "Domains", string.Empty,
                                                           0, string.Empty, SystemGuid.Attribute.DOMAINS);

            RockMigrationHelper.AddGroupTypeGroupAttribute(SystemGuid.GroupType.ACME_CERTIFICATES,
                                                           Rock.SystemGuid.FieldType.DATE_TIME, "Last Renewed", string.Empty,
                                                           1, string.Empty, SystemGuid.Attribute.LAST_RENEWED);

            RockMigrationHelper.AddGroupTypeGroupAttribute(SystemGuid.GroupType.ACME_CERTIFICATES,
                                                           Rock.SystemGuid.FieldType.TEXT, "Certificate Hash", string.Empty,
                                                           2, string.Empty, SystemGuid.Attribute.CERTIFICATE_HASH);

            RockMigrationHelper.AddGroupTypeGroupAttribute(SystemGuid.GroupType.ACME_CERTIFICATES,
                                                           Rock.SystemGuid.FieldType.TEXT, "Bindings", string.Empty,
                                                           3, string.Empty, SystemGuid.Attribute.BINDINGS);

            RockMigrationHelper.AddGroupTypeGroupAttribute(SystemGuid.GroupType.ACME_CERTIFICATES,
                                                           Rock.SystemGuid.FieldType.TEXT, "Remove Old Certificate", string.Empty,
                                                           4, string.Empty, SystemGuid.Attribute.REMOVE_OLD_CERTIFICATE);

            RockMigrationHelper.AddBlockType("Acme Config",
                                             "Configures the Acme certification system.",
                                             "~/Plugins/com_blueboxmoon/AcmeCertificate/AcmeConfig.ascx",
                                             "Blue Box Moon > Acme Certificate",
                                             SystemGuid.BlockType.ACME_CONFIG);

            RockMigrationHelper.AddBlockType("Acme Certificates",
                                             "Lists the certificate configuration.",
                                             "~/Plugins/com_blueboxmoon/AcmeCertificate/AcmeCertificates.ascx",
                                             "Blue Box Moon > Acme Certificate",
                                             SystemGuid.BlockType.ACME_CERTIFICATES);

            RockMigrationHelper.AddBlockType("Acme Certificate Detail",
                                             "Configures a certificate.",
                                             "~/Plugins/com_blueboxmoon/AcmeCertificate/AcmeCertificateDetail.ascx",
                                             "Blue Box Moon > Acme Certificate",
                                             SystemGuid.BlockType.ACME_CERTIFICATE_DETAIL);

            RockMigrationHelper.AddBlockType("Acme Challenge",
                                             "Responds to challenges for the Acme certification system.",
                                             "~/Plugins/com_blueboxmoon/AcmeCertificate/AcmeChallenge.ascx",
                                             "Blue Box Moon > Acme Certificate",
                                             SystemGuid.BlockType.ACME_CHALLENGE);

            RockMigrationHelper.AddBlockTypeAttribute(SystemGuid.BlockType.ACME_CERTIFICATES,
                                                      Rock.SystemGuid.FieldType.PAGE_REFERENCE,
                                                      "Detail Page", "DetailPage", string.Empty, string.Empty,
                                                      0, string.Empty, SystemGuid.Attribute.DETAIL_PAGE);

            RockMigrationHelper.AddPage(SystemGuid.Page.ROCK_INSTALLED_PLUGINS,
                                        "D65F783D-87A9-4CC9-8110-E83466A0EADB",
                                        "Acme Certificates",
                                        string.Empty,
                                        SystemGuid.Page.ACME_CERTIFICATES,
                                        "fa fa-certificate");

            RockMigrationHelper.AddPage(SystemGuid.Page.ACME_CERTIFICATES,
                                        "D65F783D-87A9-4CC9-8110-E83466A0EADB",
                                        "Acme Certificate Detail",
                                        string.Empty,
                                        SystemGuid.Page.ACME_CERTIFICATE_DETAIL,
                                        "fa fa-certificate");

            RockMigrationHelper.AddPage(SystemGuid.Page.ACME_CERTIFICATES,
                                        "D65F783D-87A9-4CC9-8110-E83466A0EADB",
                                        "Acme Challenge",
                                        string.Empty,
                                        SystemGuid.Page.ACME_CERTIFICATE_CHALLENGE);
            RockMigrationHelper.AddPageRoute(SystemGuid.Page.ACME_CERTIFICATE_CHALLENGE, ".well-known/acme-challenge/{Token}");

            RockMigrationHelper.AddBlock(SystemGuid.Page.ACME_CERTIFICATES,
                                         string.Empty, SystemGuid.BlockType.ACME_CONFIG,
                                         "Acme Config", "Main", string.Empty, string.Empty, 0, SystemGuid.Block.ACME_CONFIG);

            RockMigrationHelper.AddBlock(SystemGuid.Page.ACME_CERTIFICATES,
                                         string.Empty, SystemGuid.BlockType.ACME_CERTIFICATES,
                                         "Acme Certificates", "Main", string.Empty, string.Empty, 1, SystemGuid.Block.ACME_CERTIFICATES);

            RockMigrationHelper.AddBlock(SystemGuid.Page.ACME_CERTIFICATE_DETAIL,
                                         string.Empty, SystemGuid.BlockType.ACME_CERTIFICATE_DETAIL,
                                         "Acme Certificate Details", "Main", string.Empty, string.Empty, 0, SystemGuid.Block.ACME_CERTIFICATE_DETAIL);

            RockMigrationHelper.AddBlock(SystemGuid.Page.ACME_CERTIFICATE_CHALLENGE,
                                         string.Empty, SystemGuid.BlockType.ACME_CHALLENGE,
                                         "Acme Challenge", "Main", string.Empty, string.Empty, 0, SystemGuid.Block.ACME_CHALLENGE);

            RockMigrationHelper.AddBlockAttributeValue(SystemGuid.Block.ACME_CERTIFICATES,
                                                       SystemGuid.Attribute.DETAIL_PAGE, SystemGuid.Page.ACME_CERTIFICATE_DETAIL);
        }
Esempio n. 10
0
        /// <summary>
        /// Ups this instance.
        /// </summary>
        public override void Up()
        {
            // check if grouptype already exists
            using (var rockContext = new RockContext())
            {
                var eventGuid = AdvancedEventGuid.AsGuid();
                if (new GroupTypeService(rockContext).Queryable().Any(gt => gt.Name == "Advanced Event Registration" || gt.Guid.Equals(eventGuid)))
                {
                    return;
                }
            }

            var migrateNamespace = false;
            var oldNamespace     = "com.kfs.EventRegistration.Advanced";

            // check if migration has previously run in case the grouptype check doesn't escape
            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();
            }

            // add primary grouptype
            RockMigrationHelper.AddGroupType("Advanced Event Registration", "This template triggers advanced features for the Event Registration module.", "Advanced Events", "Member", false, true, true, "fa fa-fire", 0, "", 0, "", AdvancedEventGuid, false);

            // add grouptype attributes to the primary grouptype
            AddGroupTypeAttribute("Rock.Model.GroupType", AdvancedEventGuid, BooleanFieldTypeGuid, "Allow Multiple Registrations", @"Should registrants be allowed to join multiple groups of this type?", 0, "False", true, "4F9CA590-882A-4A2A-9262-C9350953C996");
            AddGroupTypeAttribute("Rock.Model.GroupType", AdvancedEventGuid, BooleanFieldTypeGuid, "Allow Volunteer Assignment", @"Should volunteers be allowed to join groups of this type?", 1, "False", true, "7129D352-5468-4BD9-BF2E-5CF9758D83BF");
            AddGroupTypeAttribute("Rock.Model.GroupType", AdvancedEventGuid, BooleanFieldTypeGuid, "Show On Grid", @"Should the Registrants grid show assignment columns for this type?", 2, "False", true, "60BD7029-9D83-42CC-B904-9A1F3A89C1E6");
            AddGroupTypeAttribute("Rock.Model.GroupType", AdvancedEventGuid, BooleanFieldTypeGuid, "Display Combined Memberships", @"Should the resource panel display a combined list of groups? If not, each group will be listed separately.", 3, "False", true, "7DD366B4-0A8C-4DA0-B14E-A17A1AFF55A6");
            AddGroupTypeAttribute("Rock.Model.GroupType", AdvancedEventGuid, BooleanFieldTypeGuid, "Display Separate Roles", @"Should the resource panel display group members separately by role?  If not, group members will be listed together.", 4, "False", true, "469BA2BC-FEB5-4C95-9BA2-B382F01C88E3");

            // add child grouptypes
            RockMigrationHelper.AddGroupType("Event Activities", "Activity Groups for Advanced Events.", "Activity", "Participant", false, true, true, "fa fa-futbol-o", 0, AdvancedEventGuid, 0, "", EventActivityGuid, false);
            RockMigrationHelper.AddGroupType("Event Lodging", "Lodging Groups for Advanced Events.", "Lodging", "Occupant", false, true, true, "fa fa-bed", 0, AdvancedEventGuid, 0, "", EventLodgingGuid, false);
            RockMigrationHelper.AddGroupType("Event Transportation", "Transportation Groups for Advanced Events.", "Vehicle", "Passenger", false, true, true, "fa fa-bus", 0, AdvancedEventGuid, 0, "", EventTransportationGuid, false);
            RockMigrationHelper.AddGroupType("Event Volunteers", "Volunteer Groups for Advanced Events.", "Group", "Volunteer", false, true, true, "fa fa-handshake-o", 0, AdvancedEventGuid, 0, GroupTypePurposeServingAreaGuid, EventVolunteerGuid, false);

            // only add the association if this is the first time
            if (!migrateNamespace)
            {
                Sql($@"
                    DECLARE @AdvancedEventId INT = (SELECT [ID] FROM GroupType WHERE [Guid] = '{AdvancedEventGuid}')
                    INSERT GroupTypeAssociation (GroupTypeId, ChildGroupTypeId)
                    VALUES (@AdvancedEventId, (SELECT [ID] FROM GroupType WHERE [Guid] = '{EventActivityGuid}')),
                        (@AdvancedEventId, (SELECT [ID] FROM GroupType WHERE [Guid] = '{EventLodgingGuid}')),
                        (@AdvancedEventId, (SELECT [ID] FROM GroupType WHERE [Guid] = '{EventTransportationGuid}')),
                        (@AdvancedEventId, (SELECT [ID] FROM GroupType WHERE [Guid] = '{EventVolunteerGuid}'))
                ");
            }

            // add group roles
            RockMigrationHelper.AddGroupTypeRole(AdvancedEventGuid, "Member", "Member of Advanced Events (not used)", 0, null, null, Guid.NewGuid().ToString(), false, false, true);
            RockMigrationHelper.AddGroupTypeRole(EventActivityGuid, "Participant", "Participant role for Advanced Event Activity Groups", 0, null, null, Guid.NewGuid().ToString(), false, false, true);
            RockMigrationHelper.AddGroupTypeRole(EventLodgingGuid, "Leader", "Leader role for Advanced Event Lodging Groups", 0, null, null, Guid.NewGuid().ToString(), false, true, false);
            RockMigrationHelper.AddGroupTypeRole(EventLodgingGuid, "Occupant", "Occupant role for Advanced Event Lodging Groups", 0, null, null, Guid.NewGuid().ToString(), false, false, true);
            RockMigrationHelper.AddGroupTypeRole(EventTransportationGuid, "Driver", "Driver role for Advanced Event Transportation Groups", 0, null, null, Guid.NewGuid().ToString(), false, true, false);
            RockMigrationHelper.AddGroupTypeRole(EventTransportationGuid, "Passenger", "Passenger role for Advanced Event Transportation Groups", 0, null, null, Guid.NewGuid().ToString(), false, false, true);
            RockMigrationHelper.AddGroupTypeRole(EventVolunteerGuid, "Member", "Member role for Advanced Event Volunteer Groups", 0, null, null, Guid.NewGuid().ToString(), false, false, true);
        }
        /// <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
            }
        }