1+ // <copyright>
2+ // Copyright by the Spark Development Network
3+ //
4+ // Licensed under the Rock Community License (the "License");
5+ // you may not use this file except in compliance with the License.
6+ // You may obtain a copy of the License at
7+ //
8+ // http://www.rockrms.com/license
9+ //
10+ // Unless required by applicable law or agreed to in writing, software
11+ // distributed under the License is distributed on an "AS IS" BASIS,
12+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ // See the License for the specific language governing permissions and
14+ // limitations under the License.
15+ // </copyright>
16+
17+ using System . Collections . Generic ;
18+
19+ namespace Rock . Plugin . HotFixes
20+ {
21+ /// <summary>
22+ /// Plug-in migration
23+ /// </summary>
24+ /// <seealso cref="Rock.Plugin.Migration" />
25+ [ MigrationNumber ( 248 , "17.1" ) ]
26+ public class MigrationRollupsForV17_1_2 : Migration
27+ {
28+ /// <summary>
29+ /// Up methods
30+ ///
31+ /// </summary>
32+ public override void Up ( )
33+ {
34+ ObsoleteAppleTVPageListBlockUp ( ) ;
35+ JPH_ImproveLoginHistoryMigration_20250506_Up ( ) ;
36+ ChopBlocksUp ( ) ;
37+ }
38+
39+ /// <summary>
40+ ///
41+ /// </summary>
42+ public override void Down ( )
43+ {
44+ }
45+
46+ #region NA: Obsolete the Apple TV Page List Block
47+
48+ private void ObsoleteAppleTVPageListBlockUp ( )
49+ {
50+ Sql ( @"UPDATE [BlockType] SET [Name] = 'Apple TV Page List (Obsolete)' WHERE [Guid] = 'a759218b-1c72-446c-8994-8559ba72941e'" ) ;
51+ }
52+
53+ #endregion
54+
55+ #region JPH: Improve Login History Migration
56+
57+ /// <summary>
58+ /// JPH: Add a post update job to prepare the new HistoryLogin table to record only true login events moving forward.
59+ /// </summary>
60+ private void JPH_ImproveLoginHistoryMigration_20250506_Up ( )
61+ {
62+ RockMigrationHelper . AddPostUpdateServiceJob (
63+ name : "Rock Update Helper v17.1 - Migrate Login History" ,
64+ description : "This job will prepare the new HistoryLogin table to record only true login events moving forward." ,
65+ jobType : "Rock.Jobs.PostV171MigrateLoginHistory" ,
66+ cronExpression : "0 0 21 1/1 * ? *" ,
67+ guid : Rock . SystemGuid . ServiceJob . DATA_MIGRATIONS_171_MIGRATE_LOGIN_HISTORY ) ;
68+ }
69+
70+ #endregion
71+
72+ #region KH: Register block attributes for chop job in v17.1 (18.0.6)
73+
74+ private void ChopBlocksUp ( )
75+ {
76+ RegisterBlockAttributesForChop ( ) ;
77+ ChopBlockTypesv17_1 ( ) ;
78+ }
79+
80+ /// <summary>
81+ /// Ensure the Entity, BlockType and Block Setting Attribute records exist
82+ /// before the chop job runs. Any missing attributes would cause the job to fail.
83+ /// </summary>
84+ private void RegisterBlockAttributesForChop ( )
85+ {
86+
87+ // Add/Update Obsidian Block Entity Type
88+ // EntityType:Rock.Blocks.Cms.LogSettings
89+ RockMigrationHelper . UpdateEntityType ( "Rock.Blocks.Cms.LogSettings" , "Log Settings" , "Rock.Blocks.Cms.LogSettings, Rock.Blocks, Version=17.1.1.0, Culture=neutral, PublicKeyToken=null" , false , false , "E5F272D4-E63F-46E7-9429-0D62CB458FD1" ) ;
90+
91+ // Add/Update Obsidian Block Entity Type
92+ // EntityType:Rock.Blocks.Core.AssetStorageProviderList
93+ RockMigrationHelper . UpdateEntityType ( "Rock.Blocks.Core.AssetStorageProviderList" , "Asset Storage Provider List" , "Rock.Blocks.Core.AssetStorageProviderList, Rock.Blocks, Version=17.1.1.0, Culture=neutral, PublicKeyToken=null" , false , false , "172E0874-E30F-4FD1-A340-99A8134D9779" ) ;
94+
95+ // Add/Update Obsidian Block Entity Type
96+ // EntityType:Rock.Blocks.Core.LogViewer
97+ RockMigrationHelper . UpdateEntityType ( "Rock.Blocks.Core.LogViewer" , "Log Viewer" , "Rock.Blocks.Core.LogViewer, Rock.Blocks, Version=17.1.1.0, Culture=neutral, PublicKeyToken=null" , false , false , "DB6A13D0-964D-4839-9E32-BF1E522D176A" ) ;
98+
99+ // Add/Update Obsidian Block Type
100+ // Name:Asset Storage Provider List
101+ // Category:Core
102+ // EntityType:Rock.Blocks.Core.AssetStorageProviderList
103+ RockMigrationHelper . AddOrUpdateEntityBlockType ( "Asset Storage Provider List" , "Displays a list of asset storage providers." , "Rock.Blocks.Core.AssetStorageProviderList" , "Core" , "2663E57E-ED73-49FE-BA16-69B4B829C488" ) ;
104+
105+ // Add/Update Obsidian Block Type
106+ // Name:Log Settings
107+ // Category:Administration
108+ // EntityType:Rock.Blocks.Cms.LogSettings
109+ RockMigrationHelper . AddOrUpdateEntityBlockType ( "Log Settings" , "Block to edit rock log settings." , "Rock.Blocks.Cms.LogSettings" , "Administration" , "FA01630C-18FB-472F-8BF1-013AF257DE3F" ) ;
110+
111+ // Add/Update Obsidian Block Type
112+ // Name:Logs
113+ // Category:Core
114+ // EntityType:Rock.Blocks.Core.LogViewer
115+ RockMigrationHelper . AddOrUpdateEntityBlockType ( "Logs" , "Block to view system logs." , "Rock.Blocks.Core.LogViewer" , "Core" , "E35992D6-C175-4C35-9DA6-A9A7115E1FFD" ) ;
116+
117+ // Attribute for BlockType
118+ // BlockType: Asset Storage Provider List
119+ // Category: Core
120+ // Attribute: core.CustomActionsConfigs
121+ RockMigrationHelper . AddOrUpdateBlockTypeAttribute ( "2663E57E-ED73-49FE-BA16-69B4B829C488" , "9C204CD0-1233-41C5-818A-C5DA439445AA" , "core.CustomActionsConfigs" , "core.CustomActionsConfigs" , "core.CustomActionsConfigs" , @"" , 0 , @"" , "DFFA9B37-1332-4B51-A6A3-A5FED0BF8939" ) ;
122+
123+ // Attribute for BlockType
124+ // BlockType: Asset Storage Provider List
125+ // Category: Core
126+ // Attribute: core.EnableDefaultWorkflowLauncher
127+ RockMigrationHelper . AddOrUpdateBlockTypeAttribute ( "2663E57E-ED73-49FE-BA16-69B4B829C488" , "1EDAFDED-DFE6-4334-B019-6EECBA89E05A" , "core.EnableDefaultWorkflowLauncher" , "core.EnableDefaultWorkflowLauncher" , "core.EnableDefaultWorkflowLauncher" , @"" , 0 , @"True" , "8E2B6DEF-D02A-41FF-BFC3-CEFF5F5BBE69" ) ;
128+
129+ // Attribute for BlockType
130+ // BlockType: Asset Storage Provider List
131+ // Category: Core
132+ // Attribute: Detail Page
133+ RockMigrationHelper . AddOrUpdateBlockTypeAttribute ( "2663E57E-ED73-49FE-BA16-69B4B829C488" , "BD53F9C9-EBA9-4D3F-82EA-DE5DD34A8108" , "Detail Page" , "DetailPage" , "Detail Page" , @"The page that will show the asset storage provider details." , 0 , @"" , "10FA745A-A70D-45F4-AFFB-EF3B6FB52345" ) ;
134+
135+ // Attribute for BlockType
136+ // BlockType: Logs
137+ // Category: Core
138+ // Attribute: core.CustomActionsConfigs
139+ RockMigrationHelper . AddOrUpdateBlockTypeAttribute ( "E35992D6-C175-4C35-9DA6-A9A7115E1FFD" , "9C204CD0-1233-41C5-818A-C5DA439445AA" , "core.CustomActionsConfigs" , "core.CustomActionsConfigs" , "core.CustomActionsConfigs" , @"" , 0 , @"" , "36BE6E4B-8843-44A4-90AC-675508664FF9" ) ;
140+
141+ // Attribute for BlockType
142+ // BlockType: Logs
143+ // Category: Core
144+ // Attribute: core.EnableDefaultWorkflowLauncher
145+ RockMigrationHelper . AddOrUpdateBlockTypeAttribute ( "E35992D6-C175-4C35-9DA6-A9A7115E1FFD" , "1EDAFDED-DFE6-4334-B019-6EECBA89E05A" , "core.EnableDefaultWorkflowLauncher" , "core.EnableDefaultWorkflowLauncher" , "core.EnableDefaultWorkflowLauncher" , @"" , 0 , @"True" , "18472384-59A7-4EBF-B507-D491285018D6" ) ;
146+ }
147+
148+ private void ChopBlockTypesv17_1 ( )
149+ {
150+ RockMigrationHelper . ReplaceWebformsWithObsidianBlockMigration (
151+ "Chop Block Types 17.1 (18.0.6)" ,
152+ blockTypeReplacements : new Dictionary < string , string > {
153+ // blocks chopped in v17.1 (Pre-Alpha: 18.0.6)
154+ { "6059FC03-E398-4359-8632-909B63FFA550" , "E35992D6-C175-4C35-9DA6-A9A7115E1FFD" } , // Logs ( Core )
155+ { "6ABC44FD-C4D7-4E30-8537-3A065B493453" , "fa01630c-18fb-472f-8bf1-013af257de3f" } , // Log Settings ( Administration )
156+ { "7A8599B0-6B69-4E1F-9D12-CA9874E8E5D8" , "2663e57e-ed73-49fe-ba16-69b4b829c488" } , // Asset Storage Provider List ( Core )
157+ // blocks chopped in v17.1 (Pre-Alpha: 18.0.5)
158+ { "6D3F924E-BDD0-4C78-981E-B698351E75AD" , "9b90f2d1-0c7b-4f08-a808-8ba4c9a70a20" } , // Scheduled Job List ( Core )
159+ { "7BD1B79C-BF27-42C6-8359-F80EC7FEE397" , "a759218b-1c72-446c-8994-8559ba72941e" } , // Apple TV Page List ( TV > TV Apps )
160+ { "881DC0D1-FF98-4A5E-827F-49DD5CD0BD32" , "d481ae29-a6aa-49f4-9dbb-d3fdf0995ca3" } , // Media Element Detail ( CMS )
161+ { "BD548744-DC6D-4870-9FED-BB9EA24E709B" , "18fa879f-1466-413b-8623-834d728f677b" } , // Person Following List ( Follow )
162+ { "BFDCA2E2-DAA1-4FA6-B33C-C53C7CF23C5D" , "FBAB4EB2-B180-4A76-9B5B-C75E2255F691" } , // Communication Template Detail ( Communication )
163+ { "C5EC90C9-26C4-493A-84AC-4B5DEF9EA472" , "762f09ea-0a11-4bc7-9a68-13f0e44217c1" } , // Scheduled Job Detail ( Core )
164+ // blocks chopped in v17.1 (Pre-Alpha: 18.0.4)
165+ { "00A86827-1E0C-4F47-8A6F-82581FA75CED" , "1fde6d4f-390a-4ff6-ad42-668ec8cc62c4" } , // Assessment Type List ( CRM )
166+ { "069554B7-983E-4653-9A28-BA39659C6D63" , "47f619c2-f66d-45ec-adbb-22ca23b4f3ad" } , // Attribute Matrix Template List ( Core )
167+ { "32183AD6-01CB-4533-858B-1BDA5120AAD5" , "7686a42f-a2c4-4c15-9331-8b364f24bd0f" } , // Device List ( Core )
168+ { "32E89BAE-C085-40B3-B872-B62E25A62BDB" , "0f99866a-7fab-462d-96eb-9f9534322c57" } , // Gateway List ( Finance )
169+ { "50ADE904-BB5C-40F9-A97D-ED8FF530B5A6" , "cfbb4daf-1aeb-4095-8098-e3a82e30fa7e" } , // Persisted Dataset List ( CMS )
170+ { "65057F07-85D5-4795-91A1-86D8F67A65DC" , "2eaf9e5a-f47d-4c58-9aa4-2d340547a35f" } , // Financial Statement Template List ( Finance )
171+ { "A580027F-56DB-43B0-AAD6-7C2B8A952012" , "29227fc7-8f24-44b1-a0fb-e6a8694f1c3b" } , // Content Channel Type List ( CMS )
172+ { "C4FBF612-C1F6-428B-97FD-8AB0B8EA31FC" , "40b6af94-5ffc-4ee3-add9-c76818992274" } , // Rest Key List ( Security )
173+ { "C6DFE5AE-8C4C-49AD-8EC9-11CE03146F53" , "0acf764f-5f60-4985-9d10-029cb042da0d" } , // Tag List ( Core )
174+ { "D8CCD577-2200-44C5-9073-FD16F174D364" , "559978d5-a392-4bd1-8e04-055c2833f347" } , // Badge List ( CRM )
175+ } ,
176+ migrationStrategy : "Chop" ,
177+ jobGuid : SystemGuid . ServiceJob . DATA_MIGRATIONS_171_CHOP_OBSIDIAN_BLOCKS ,
178+ blockAttributeKeysToIgnore : new Dictionary < string , string > { } ) ;
179+ }
180+
181+ #endregion
182+ }
183+ }
0 commit comments