From dfe2bef734c95c8ca8282132658d5b2320d3218e Mon Sep 17 00:00:00 2001 From: Russel Cole Date: Mon, 18 Mar 2024 12:25:35 +0000 Subject: [PATCH 1/4] [twgit] Init feature 'feature-PRESIDECMS-2812_async-db-migration-priority'. From df7e8346e8639d2cd0bba8352386a4ecb4ae9de1 Mon Sep 17 00:00:00 2001 From: Russel Cole Date: Mon, 18 Mar 2024 12:33:11 +0000 Subject: [PATCH 2/4] PRESIDECMS-2812 async db migrations with priority --- .../AppDatabaseMigrationService.cfc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/system/services/updateManager/AppDatabaseMigrationService.cfc b/system/services/updateManager/AppDatabaseMigrationService.cfc index aa0d55b41e..7aa1a9d0e6 100644 --- a/system/services/updateManager/AppDatabaseMigrationService.cfc +++ b/system/services/updateManager/AppDatabaseMigrationService.cfc @@ -49,6 +49,22 @@ component { } } + if ( arguments.async ) { + var migrationsWithPriority = {}; + + for ( migration in migrations ) { + var priority = $runEvent( + event = "dbmigrations.#migration#.asyncPriority" + , private = true + , prepostExempt = true + ); + + migrationsWithPriority[ migration ] = priority ?: 1; + } + + migrations = StructSort( migrationsWithPriority, "numeric" ); + } + return migrations; } From 9c3a264f37894c0e3fed4b40bfaf104b67939699 Mon Sep 17 00:00:00 2001 From: Russel Cole Date: Wed, 27 Nov 2024 09:52:39 +0000 Subject: [PATCH 3/4] PRESIDECMS-2812 handlerExists for asyncPriorityHandler --- .../AppDatabaseMigrationService.cfc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/system/services/updateManager/AppDatabaseMigrationService.cfc b/system/services/updateManager/AppDatabaseMigrationService.cfc index 7aa1a9d0e6..8b6fb861e8 100644 --- a/system/services/updateManager/AppDatabaseMigrationService.cfc +++ b/system/services/updateManager/AppDatabaseMigrationService.cfc @@ -53,13 +53,18 @@ component { var migrationsWithPriority = {}; for ( migration in migrations ) { - var priority = $runEvent( - event = "dbmigrations.#migration#.asyncPriority" - , private = true - , prepostExempt = true - ); + var asyncPriorityHandler = "dbmigrations.#migration#.asyncPriority"; + if ( $getColdbox().handlerExists( asyncPriorityHandler ) ) { + var priority = $runEvent( + event = asyncPriorityHandler + , private = true + , prepostExempt = true + ); - migrationsWithPriority[ migration ] = priority ?: 1; + migrationsWithPriority[ migration ] = priority ?: 1; + } else { + migrationsWithPriority[ migration ] = 1; + } } migrations = StructSort( migrationsWithPriority, "numeric" ); From d1a97f4b7af1b97d0912cc553a981e91cb6dfd1a Mon Sep 17 00:00:00 2001 From: Russel Cole Date: Wed, 27 Nov 2024 11:32:46 +0000 Subject: [PATCH 4/4] PRESIDECMS-2812 missing var --- system/services/updateManager/AppDatabaseMigrationService.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/services/updateManager/AppDatabaseMigrationService.cfc b/system/services/updateManager/AppDatabaseMigrationService.cfc index 8b6fb861e8..27b698af09 100644 --- a/system/services/updateManager/AppDatabaseMigrationService.cfc +++ b/system/services/updateManager/AppDatabaseMigrationService.cfc @@ -52,7 +52,7 @@ component { if ( arguments.async ) { var migrationsWithPriority = {}; - for ( migration in migrations ) { + for ( var migration in migrations ) { var asyncPriorityHandler = "dbmigrations.#migration#.asyncPriority"; if ( $getColdbox().handlerExists( asyncPriorityHandler ) ) { var priority = $runEvent(