From 60d21e7637d4df3db3b993130e8512c4a062f0e6 Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 3 Apr 2023 09:42:59 -0400 Subject: [PATCH] Fix down migrations --- .../Database/DatabaseContext.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Tgstation.Server.Host/Database/DatabaseContext.cs b/src/Tgstation.Server.Host/Database/DatabaseContext.cs index 57159bdb32..bf77cbd332 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseContext.cs @@ -379,22 +379,22 @@ namespace Tgstation.Server.Host.Database /// /// Used by unit tests to remind us to setup the correct MSSQL migration downgrades. /// - internal static readonly Type MSLatestMigration = typeof(MSAddDreamDaemonLogOutput); + internal static readonly Type MSLatestMigration = typeof(MSAddReattachInfoInitialCompileJob); /// /// Used by unit tests to remind us to setup the correct MYSQL migration downgrades. /// - internal static readonly Type MYLatestMigration = typeof(MYAddDreamDaemonLogOutput); + internal static readonly Type MYLatestMigration = typeof(MYAddReattachInfoInitialCompileJob); /// /// Used by unit tests to remind us to setup the correct PostgresSQL migration downgrades. /// - internal static readonly Type PGLatestMigration = typeof(PGAddDreamDaemonLogOutput); + internal static readonly Type PGLatestMigration = typeof(PGAddReattachInfoInitialCompileJob); /// /// Used by unit tests to remind us to setup the correct SQLite migration downgrades. /// - internal static readonly Type SLLatestMigration = typeof(SLAddDreamDaemonLogOutput); + internal static readonly Type SLLatestMigration = typeof(SLAddReattachInfoInitialCompileJob); /// #pragma warning disable CA1502 // Cyclomatic complexity @@ -425,6 +425,15 @@ namespace Tgstation.Server.Host.Database string BadDatabaseType() => throw new ArgumentException($"Invalid DatabaseType: {currentDatabaseType}", nameof(currentDatabaseType)); + if (targetVersion < new Version(5, 7, 3)) + targetMigration = currentDatabaseType switch + { + DatabaseType.MySql => nameof(MYAddDreamDaemonLogOutput), + DatabaseType.PostgresSql => nameof(PGAddDreamDaemonLogOutput), + DatabaseType.SqlServer => nameof(MSAddDreamDaemonLogOutput), + DatabaseType.Sqlite => nameof(SLAddDreamDaemonLogOutput), + _ => BadDatabaseType(), + }; if (targetVersion < new Version(5, 7, 0)) targetMigration = currentDatabaseType switch {