From fbd8d4d23fe18243cf2f74b2dc31797010ccbc90 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 11 May 2020 11:58:37 -0400 Subject: [PATCH] Add heartbeat backwards migration --- .../Database/DatabaseContext.cs | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/Tgstation.Server.Host/Database/DatabaseContext.cs b/src/Tgstation.Server.Host/Database/DatabaseContext.cs index bc22c30c95..fe296f825a 100644 --- a/src/Tgstation.Server.Host/Database/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Database/DatabaseContext.cs @@ -348,30 +348,12 @@ namespace Tgstation.Server.Host.Database if (version < new Version(4, 0)) throw new ArgumentOutOfRangeException(nameof(version), version, "Not a valid V4 version!"); - string targetMigration = null; - // Update this with new migrations as they are made - // Always use the MS class - if (version < new Version(4, 0, 2)) - { - // Special handling because this is where SQLite was introduced - if (DatabaseType == DatabaseType.Sqlite) - throw new NotSupportedException("Cannot migrate below version 4.0.2.0 while using Sqlite!"); - - targetMigration = nameof(MSReattachCompileJobRequired); - } - - // Uncomment once next migration/version step happens - /* - else if (version < new Version(V_NEXT_MIGRATION)) - { - // Special handling because this is where SQLite was introduced - if (DatabaseType == DatabaseType.Sqlite) - targetMigration = nameof(SLAddSqlite); - - targetMigration = nameof(V_NEXT_LAST_MIGRATION); - } - */ + string targetMigration = null; + if (version < new Version(4, 1, 0)) + throw new NotSupportedException("Cannot migrate below version 4.1.0!"); + else if (version < new Version(4, 2, 0)) + targetMigration = DatabaseType == DatabaseType.Sqlite ? nameof(SLRebuild) : nameof(MSFixCascadingDelete); if (targetMigration == null) {