Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql =================================================================== diff -u -r6a60e0e3f676c71e253ad41839519c18dd641e9e -rc71a88004ecb3157a05d92cf9302fef4edde5549 --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision c71a88004ecb3157a05d92cf9302fef4edde5549) @@ -768,6 +768,7 @@ "* Geen aanpassingen." WHERE ( SELECT COUNT() FROM [LOGDATABASE].MigrationLogEntity + WHERE [FromVersion] = "17.1" ) IS 1; DETACH LOGDATABASE; Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql =================================================================== diff -u -r846f486f41ba1b63fb540d045781538dab026baa -rc71a88004ecb3157a05d92cf9302fef4edde5549 --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision 846f486f41ba1b63fb540d045781538dab026baa) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision c71a88004ecb3157a05d92cf9302fef4edde5549) @@ -533,6 +533,7 @@ "* Geen aanpassingen." WHERE ( SELECT COUNT() FROM [LOGDATABASE].MigrationLogEntity + WHERE [FromVersion] = "5" ) IS 1; DETACH LOGDATABASE; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs =================================================================== diff -u -r4e99812f9957b2b7d9299207726ec4ccc70d157c -rc71a88004ecb3157a05d92cf9302fef4edde5549 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision 4e99812f9957b2b7d9299207726ec4ccc70d157c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision c71a88004ecb3157a05d92cf9302fef4edde5549) @@ -85,6 +85,43 @@ } } + [Test] + public void GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade() + { + // Given + string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration.Core, + "Empty valid [Release 16.4].rtd"); + var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); + + string targetFilePath = TestHelper.GetScratchPadPath( + nameof(GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade)); + string logFilePath = TestHelper.GetScratchPadPath( + string.Concat(nameof(GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade), ".log")); + var migrator = new RingtoetsSqLiteDatabaseFileMigrator + { + LogPath = logFilePath + }; + + using (new FileDisposeHelper(logFilePath)) + using (new FileDisposeHelper(targetFilePath)) + { + // When + migrator.Migrate(fromVersionedFile, newVersion, targetFilePath); + + using (var reader = new MigrationLogDatabaseReader(logFilePath)) + { + ReadOnlyCollection messages = reader.GetMigrationLogMessages(); + Assert.AreEqual(2, messages.Count); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", "17.1", "Gevolgen van de migratie van versie 16.4 naar versie 17.1:"), + messages[0]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", "17.1", "* Geen aanpassingen."), + messages[1]); + } + } + } + private static void AssertTablesContentMigrated(MigratedDatabaseReader reader, string sourceFilePath) { var tables = new[] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs =================================================================== diff -u -r8be0baccddc62b1efd47bc2469c597c3e480e6b8 -rc71a88004ecb3157a05d92cf9302fef4edde5549 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision 8be0baccddc62b1efd47bc2469c597c3e480e6b8) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision c71a88004ecb3157a05d92cf9302fef4edde5549) @@ -77,6 +77,86 @@ } } + [Test] + public void GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade() + { + // Given + string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration.Core, + "Empty valid [Release 16.4].rtd"); + var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); + + string targetFilePath = TestHelper.GetScratchPadPath( + nameof(GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade)); + string logFilePath = TestHelper.GetScratchPadPath( + string.Concat(nameof(GivenEmpty164Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade), ".log")); + var migrator = new RingtoetsSqLiteDatabaseFileMigrator + { + LogPath = logFilePath + }; + + using (new FileDisposeHelper(logFilePath)) + using (new FileDisposeHelper(targetFilePath)) + { + // When + migrator.Migrate(fromVersionedFile, newVersion, targetFilePath); + + using (var reader = new MigrationLogDatabaseReader(logFilePath)) + { + ReadOnlyCollection messages = reader.GetMigrationLogMessages(); + Assert.AreEqual(4, messages.Count); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", "17.1", "Gevolgen van de migratie van versie 16.4 naar versie 17.1:"), + messages[0]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", "17.1", "* Geen aanpassingen."), + messages[1]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", "17.2", "Gevolgen van de migratie van versie 17.1 naar versie 17.2:"), + messages[2]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", "17.2", "* Geen aanpassingen."), + messages[3]); + } + } + } + + [Test] + public void GivenEmpty171Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade() + { + // Given + string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration.Core, + "Empty valid [Release 17.1].rtd"); + var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath); + + string targetFilePath = TestHelper.GetScratchPadPath( + nameof(GivenEmpty171Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade)); + string logFilePath = TestHelper.GetScratchPadPath( + string.Concat(nameof(GivenEmpty171Project_WhenNoChangesMade_ThenLogDatabaseContainsMessagesSayingNoChangesMade), ".log")); + var migrator = new RingtoetsSqLiteDatabaseFileMigrator + { + LogPath = logFilePath + }; + + using (new FileDisposeHelper(logFilePath)) + using (new FileDisposeHelper(targetFilePath)) + { + // When + migrator.Migrate(fromVersionedFile, newVersion, targetFilePath); + + using (var reader = new MigrationLogDatabaseReader(logFilePath)) + { + ReadOnlyCollection messages = reader.GetMigrationLogMessages(); + Assert.AreEqual(2, messages.Count); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", "17.2", "Gevolgen van de migratie van versie 17.1 naar versie 17.2:"), + messages[0]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", "17.2", "* Geen aanpassingen."), + messages[1]); + } + } + } + private static void AssertTablesContentMigrated(MigratedDatabaseReader reader, string sourceFilePath) { var tables = new[]