Last active
April 2, 2024 17:22
-
-
Save PraveenMathew92/adb3cd36aaa8ec8917be9c51dfeb0f0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// PA: Add BlockAttributeKeysToIgnore Attribute to PostUpdateDataMigrationsReplaceWebFormsBlocksWithObsidianBlocks Job. | |
/// Also populate the existing jobs with the Block Attributes to be ignored so that they do not fail. | |
/// </summary> | |
private void AddBlockAttributeKeysToIgnoreAttributeToPostUpdateDataMigrationsReplaceWebFormsBlocksWithObsidianBlocksJob() | |
{ | |
// Update the Block Attribute Key of the old webforms Login Legacy block to match the corresponding one in the new Obsidian version. | |
Sql( "UPDATE [ATTRIBUTE] SET [KEY] = 'HideNewAccountOption' WHERE [GUID] = '7D47046D-5D66-45BB-ACFA-7460DE112FC2'" ); | |
// Update the Block Attribute Keys of the old webforms Group Registration block to match the corresponding ones in the new Obsidian version. | |
Sql( "UPDATE [ATTRIBUTE] SET [KEY] = 'RequireEmail' WHERE [GUID] = '37E22E5F-19C9-4F17-8E1D-8C0E5F52DE1D'" ); | |
Sql( "UPDATE [ATTRIBUTE] SET [KEY] = 'RequireMobilePhone' WHERE [GUID] = '7CE78567-4438-47E7-B0D0-25D5B6498515'" ); | |
// Add the attribute to the existing Chop/Swap job if needed. | |
RockMigrationHelper.AddOrUpdateEntityAttribute( "Rock.Model.ServiceJob", Rock.SystemGuid.FieldType.KEY_VALUE_LIST, "Class", "Rock.Jobs.PostUpdateDataMigrationsReplaceWebFormsBlocksWithObsidianBlocks", "Webform BlockType Attribute Keys To Ignore During Validation", "Webform BlockType Attribute Keys To Ignore During Validation", "A Guid [key] of the old Webform BlockType and the [value] as a comma delimited list of BlockType Attribute keys to ignore when validating the Obsidian and Webforms blocks have the same keys.", 3, "", "D5122332-BA5E-4919-BCE0-5F8EF301B43C", "BlockAttributeKeysToIgnore" ); | |
// Exclude Attributes from the BlockTypes. | |
Sql( $@" | |
DECLARE @ServiceJobEntityTypeId INT = (SELECT [Id] FROM [EntityType] WHERE [Name] = 'Rock.Model.ServiceJob' ) | |
-- Get the Attribute Id For Service Job by the key | |
DECLARE @AttributeId int | |
SET @AttributeId = ( | |
SELECT [Id] | |
FROM [Attribute] | |
WHERE [EntityTypeId] = @ServiceJobEntityTypeId | |
AND [EntityTypeQualifierColumn] = 'Class' | |
AND [EntityTypeQualifierValue] = 'Rock.Jobs.PostUpdateDataMigrationsReplaceWebFormsBlocksWithObsidianBlocks' | |
AND [Key] = 'BlockAttributeKeysToIgnore' ); | |
DECLARE @ChopEmailPreferenceEntryServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '{ServiceJob.DATA_MIGRATIONS_162_CHOP_EMAIL_PREFERENCE_ENTRY}'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopEmailPreferenceEntryServiceJobId ) AND @ChopEmailPreferenceEntryServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopEmailPreferenceEntryServiceJobId, N'B3C076C7-1325-4453-9549-456C23702069^UnsubscribefromListText', NEWID()); | |
END | |
DECLARE @ChopGroupScheduleV1ServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '{ServiceJob.DATA_MIGRATIONS_161_SWAP_BLOCK_GROUP_SCHEDULE_TOOLBOX_V1}'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopGroupScheduleV1ServiceJobId ) AND @ChopGroupScheduleV1ServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopGroupScheduleV1ServiceJobId, N'7F9CEA6F-DCE5-4F60-A551-924965289F1D^SignupInstructions,DeclineReasonPage,FutureWeeksToShow,EnableSignup', NEWID()); | |
END | |
DECLARE @ChopGroupScheduleV2ServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '{ServiceJob.DATA_MIGRATIONS_161_CHOP_BLOCK_GROUP_SCHEDULE_TOOLBOX_V2}'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopGroupScheduleV2ServiceJobId ) AND @ChopGroupScheduleV2ServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopGroupScheduleV2ServiceJobId, N'18A6DCE3-376C-4A62-B1DD-5E5177C11595^SignupInstructions,DeclineReasonPage', NEWID()); | |
END | |
DECLARE @SwapFinancialBatchListServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '7750ECFD-26E3-49DE-8E90-1B1A6DCCC3FE'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @SwapFinancialBatchListServiceJobId ) AND @SwapFinancialBatchListServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @SwapFinancialBatchListServiceJobId, N'AB345CE7-5DC6-41AF-BBDC-8D23D52AFE25^SummaryLavaTemplate', NEWID()); | |
END | |
DECLARE @ChopAccountEntryLoginServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = 'A65D26C1-229E-4198-B388-E269C3534BC0'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopAccountEntryLoginServiceJobId ) AND @ChopAccountEntryLoginServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopAccountEntryLoginServiceJobId, N'7B83D513-1178-429E-93FF-E76430E038E4^RemoteAuthorizationTypes', NEWID() ); | |
END | |
DECLARE @ChopGroupRegistrationServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '72D9EC04-517A-4CA0-B631-9F9A41F1790D'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopGroupRegistrationServiceJobId ) AND @ChopGroupRegistrationServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopGroupRegistrationServiceJobId, N'9D0EF3AC-D0F7-4FA7-9C64-E7B0855648C7^EnableDebug', NEWID() ); | |
END | |
DECLARE @ChopBlockTypesGroup1 int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '54FACAE5-2175-4FE0-AC9F-5CDA957BCFB5'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopBlockTypesGroup1 ) AND @ChopBlockTypesGroup1 IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopBlockTypesGroup1, N'CE34CE43-2CCF-4568-9AEB-3BE203DB3470^DetailPage', NEWID() ); | |
END | |
DECLARE @SwapNoteBlockTypeServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '8390C1AC-88D6-474A-AC05-8FFBD358F75D'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @SwapNoteBlockTypeServiceJobId ) AND @SwapNoteBlockTypeServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @SwapNoteBlockTypeServiceJobId, N'2E9F32D4-B4FC-4A5F-9BE1-B2E3EA624DD3^NoteViewLavaTemplate,NoteType', NEWID() ); | |
END | |
DECLARE @ChopFamilyPreRegistrationServiceJobId int = (SELECT [Id] FROM [ServiceJob] WHERE [Guid] = '{ServiceJob.DATA_MIGRATIONS_152_REPLACE_WEB_FORMS_BLOCKS_WITH_OBSIDIAN_BLOCKS}'); | |
IF NOT EXISTS ( SELECT * FROM [AttributeValue] WHERE [AttributeId] = @AttributeId AND [EntityId] = @ChopFamilyPreRegistrationServiceJobId ) AND @ChopFamilyPreRegistrationServiceJobId IS NOT NULL | |
BEGIN | |
INSERT INTO [AttributeValue] ([IsSystem], [AttributeId], [EntityId], [Value], [Guid]) | |
VALUES (1, @AttributeId, @ChopFamilyPreRegistrationServiceJobId, N'463A454A-6370-4B4A-BCA1-415F2D9B0CB7^Columns,ShowCampusType,ShowCampusStatus', NEWID() ); | |
END | |
" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment