Migrations: Set a long timeout by default on the migration of system dates (closes #21013) (#21022)

Set a long timeout by default on the migration of system dates.
This commit is contained in:
Andy Butland
2025-12-01 19:13:55 +01:00
parent 822a2fcf70
commit 35f73a8a31

View File

@@ -96,6 +96,14 @@ public class MigrateSystemDatesToUtc : UnscopedMigrationBase
using IScope scope = _scopeProvider.CreateScope(); using IScope scope = _scopeProvider.CreateScope();
using IDisposable notificationSuppression = scope.Notifications.Suppress(); using IDisposable notificationSuppression = scope.Notifications.Suppress();
// Ensure we have a long command timeout as this migration can take a while on large tables within the database.
// If the command timeout is already longer, applied via the connection string with "Connect Timeout={timeout}" we leave it as is.
const int CommandTimeoutInSeconds = 300;
if (scope.Database.CommandTimeout < CommandTimeoutInSeconds)
{
scope.Database.CommandTimeout = CommandTimeoutInSeconds;
}
MigrateDateColumn(scope, "cmsMember", "emailConfirmedDate", timeZone); MigrateDateColumn(scope, "cmsMember", "emailConfirmedDate", timeZone);
MigrateDateColumn(scope, "cmsMember", "lastLoginDate", timeZone); MigrateDateColumn(scope, "cmsMember", "lastLoginDate", timeZone);
MigrateDateColumn(scope, "cmsMember", "lastLockoutDate", timeZone); MigrateDateColumn(scope, "cmsMember", "lastLockoutDate", timeZone);