Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql =================================================================== diff -u -r822454c220663c9f42d1293365eb8825ec197540 -r7b85ca059e69c55b69321604dee21c69f2b442fc --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 822454c220663c9f42d1293365eb8825ec197540) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 7b85ca059e69c55b69321604dee21c69f2b442fc) @@ -139,13 +139,13 @@ [Y], [X0], [Order] - FROM (SELECT *, MaxLength - LENGTH(NAME) as SuffixPreLength, (SELECT FS.rowid + FROM (SELECT *, MaxLength - LENGTH(Id) as SuffixPreLength, (SELECT FS.rowid FROM [SOURCEPROJECT].ForeshoreProfileEntity WHERE FS.ForeshoreProfileEntityId > ForeshoreProfileEntityId - AND FS.Name IS Name + AND FS.Id IS Id AND FS.FailuremechanismEntityId = FailuremechanismEntityId) as Suffix FROM [SOURCEPROJECT].ForeshoreProfileEntity FS - JOIN (SELECT MAX(LENGTH(Name)) as MaxLength FROM [SOURCEPROJECT].ForeshoreProfileEntity)); + JOIN (SELECT MAX(LENGTH(Id)) as MaxLength FROM [SOURCEPROJECT].ForeshoreProfileEntity)); INSERT INTO GrassCoverErosionInwardsCalculationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsCalculationEntity; INSERT INTO GrassCoverErosionInwardsDikeHeightOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsDikeHeightOutputEntity; INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity; @@ -479,10 +479,6 @@ */ ATTACH DATABASE '{1}' AS LOGDATABASE; -CREATE TEMP TABLE log_output_deleted ( - 'NrDeleted' INTEGER NOT NULL -); - CREATE TABLE IF NOT EXISTS [LOGDATABASE].'MigrationLogEntity' ( 'MigrationLogEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, @@ -491,8 +487,50 @@ 'LogMessage' TEXT NOT NULL ); -DROP TABLE log_output_deleted; +INSERT INTO [LOGDATABASE].MigrationLogEntity( + [FromVersion], + [ToVersion], + [LogMessage]) +SELECT "17.1", + "17.2", + "Het ID van voorlandprofiel '" || source.Id || "' is veranderd naar '" || fp.Id || "'." + FROM ForeshoreProfileEntity as fp + JOIN [SOURCEPROJECT].ForeshoreProfileEntity as source ON fp.rowid = source.rowid + WHERE source.Id IS NOT fp.Id; +INSERT INTO [LOGDATABASE].MigrationLogEntity( + [FromVersion], + [ToVersion], + [LogMessage]) +SELECT "17.1", + "17.2", + "Het ID van hoogte kunstwerk '" || source.Id || "' is veranderd naar '" || hs.Id || "'." + FROM HeightStructureEntity as hs + JOIN [SOURCEPROJECT].HeightStructureEntity as source ON hs.rowid = source.rowid + WHERE source.Id IS NOT hs.Id; + +INSERT INTO [LOGDATABASE].MigrationLogEntity( + [FromVersion], + [ToVersion], + [LogMessage]) +SELECT "17.1", + "17.2", + "Het ID van sluiten kunstwerk '" || source.Id || "' is veranderd naar '" || cs.Id || "'." + FROM ClosingStructureEntity as cs + JOIN [SOURCEPROJECT].ClosingStructureEntity as source ON cs.rowid = source.rowid + WHERE source.Id IS NOT cs.Id; + +INSERT INTO [LOGDATABASE].MigrationLogEntity( + [FromVersion], + [ToVersion], + [LogMessage]) +SELECT "17.1", + "17.2", + "Het ID van stabiliteit puntconstructies kunstwerk '" || source.Id || "' is veranderd naar '" || sps.Id || "'." + FROM StabilityPointStructureEntity as sps + JOIN [SOURCEPROJECT].StabilityPointStructureEntity as source ON sps.rowid = source.rowid + WHERE source.Id IS NOT sps.Id; + DETACH LOGDATABASE; DETACH SOURCEPROJECT; Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql =================================================================== diff -u -r822454c220663c9f42d1293365eb8825ec197540 -r7b85ca059e69c55b69321604dee21c69f2b442fc --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision 822454c220663c9f42d1293365eb8825ec197540) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_5_17.1.sql (.../Migration_5_17.1.sql) (revision 7b85ca059e69c55b69321604dee21c69f2b442fc) @@ -370,6 +370,17 @@ DROP TABLE log_output_deleted; +INSERT INTO [LOGDATABASE].MigrationLogEntity( + [FromVersion], + [ToVersion], + [LogMessage]) +SELECT "5", + "17.1", + "De naam van dijkprofiel '" || source.Name || "' is veranderd naar '" || dp.Id || "' en wordt ook gebruikt als ID." + FROM DikeProfileEntity as dp + JOIN [SOURCEPROJECT].DikeProfileEntity as source ON dp.rowid = source.rowid + WHERE source.Name IS NOT dp.Id; + DETACH LOGDATABASE; DETACH SOURCEPROJECT; Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject171.rtd =================================================================== diff -u -r52e0b92633892fea03ebceb73061e17b0b78f49f -r7b85ca059e69c55b69321604dee21c69f2b442fc Binary files differ Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs =================================================================== diff -u -r822454c220663c9f42d1293365eb8825ec197540 -r7b85ca059e69c55b69321604dee21c69f2b442fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision 822454c220663c9f42d1293365eb8825ec197540) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo171IntegrationTest.cs (.../MigrationTo171IntegrationTest.cs) (revision 7b85ca059e69c55b69321604dee21c69f2b442fc) @@ -260,9 +260,16 @@ { ReadOnlyCollection messages = reader.GetMigrationLogMessages(); - Assert.AreEqual(1, messages.Count); - var expectedMessage = new MigrationLogMessage("5", newVersion, "Alle berekende resultaten zijn verwijderd."); - AssertMigrationLogMessageEqual(expectedMessage, messages[0]); + Assert.AreEqual(3, messages.Count); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", newVersion, "Alle berekende resultaten zijn verwijderd."), + messages[0]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", newVersion, "De naam van dijkprofiel '1' is veranderd naar '102' en wordt ook gebruikt als ID."), + messages[1]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("5", newVersion, "De naam van dijkprofiel '10' is veranderd naar '104' en wordt ook gebruikt als ID."), + messages[2]); } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs =================================================================== diff -u -r822454c220663c9f42d1293365eb8825ec197540 -r7b85ca059e69c55b69321604dee21c69f2b442fc --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision 822454c220663c9f42d1293365eb8825ec197540) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision 7b85ca059e69c55b69321604dee21c69f2b442fc) @@ -261,10 +261,38 @@ { ReadOnlyCollection messages = reader.GetMigrationLogMessages(); - Assert.AreEqual(0, messages.Count); + Assert.AreEqual(7, messages.Count); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van voorlandprofiel '10' is veranderd naar '10004'."), + messages[0]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van voorlandprofiel '100' is veranderd naar '10006'."), + messages[1]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van hoogte kunstwerk '10' is veranderd naar '104'."), + messages[2]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van sluiten kunstwerk '1' is veranderd naar '102'."), + messages[3]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van sluiten kunstwerk '10' is veranderd naar '104'."), + messages[4]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van stabiliteit puntconstructies kunstwerk '1' is veranderd naar '102'."), + messages[5]); + AssertMigrationLogMessageEqual( + new MigrationLogMessage("17.1", newVersion, "Het ID van stabiliteit puntconstructies kunstwerk '10' is veranderd naar '104'."), + messages[6]); } } + private static void AssertMigrationLogMessageEqual(MigrationLogMessage expected, MigrationLogMessage actual) + { + Assert.AreEqual(expected.ToVersion, actual.ToVersion); + Assert.AreEqual(expected.FromVersion, actual.FromVersion); + Assert.AreEqual(expected.Message, actual.Message); + } + private static void AssertVersions(MigratedDatabaseReader reader) { const string validateVersion =