Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql =================================================================== diff -u -r20a7f01e04fc17eee5db148fbb7e5a0f21be0d0f -rc96dfce6fc55cd553d4abe87703f7c17ec35c393 --- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision 20a7f01e04fc17eee5db148fbb7e5a0f21be0d0f) +++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/EmbeddedResources/Migration_17.1_17.2.sql (.../Migration_17.1_17.2.sql) (revision c96dfce6fc55cd553d4abe87703f7c17ec35c393) @@ -71,48 +71,48 @@ INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity; INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity; INSERT INTO HeightStructureEntity ( - [HeightStructureEntityId], - [FailureMechanismEntityId], - [Order], - [Name], - [Id], - [X], - [Y], - [StructureNormalOrientation], - [LevelCrestStructureMean], - [LevelCrestStructureStandardDeviation], - [FlowWidthAtBottomProtectionMean], - [FlowWidthAtBottomProtectionStandardDeviation], - [CriticalOvertoppingDischargeMean], - [CriticalOvertoppingDischargeCoefficientOfVariation], - [WidthFlowAperturesMean], - [WidthFlowAperturesStandardDeviation], - [FailureProbabilityStructureWithErosion], - [StorageStructureAreaMean], - [StorageStructureAreaCoefficientOfVariation], - [AllowedLevelIncreaseStorageMean], + [HeightStructureEntityId], + [FailureMechanismEntityId], + [Order], + [Name], + [Id], + [X], + [Y], + [StructureNormalOrientation], + [LevelCrestStructureMean], + [LevelCrestStructureStandardDeviation], + [FlowWidthAtBottomProtectionMean], + [FlowWidthAtBottomProtectionStandardDeviation], + [CriticalOvertoppingDischargeMean], + [CriticalOvertoppingDischargeCoefficientOfVariation], + [WidthFlowAperturesMean], + [WidthFlowAperturesStandardDeviation], + [FailureProbabilityStructureWithErosion], + [StorageStructureAreaMean], + [StorageStructureAreaCoefficientOfVariation], + [AllowedLevelIncreaseStorageMean], [AllowedLevelIncreaseStorageStandardDeviation]) SELECT - [HeightStructureEntityId], - [FailureMechanismEntityId], - [Order], - [Name], - CASE WHEN Suffix THEN [Id] || '(' || Suffix || ')' ELSE [Id] END as [Id], - [X], - [Y], - [StructureNormalOrientation], - [LevelCrestStructureMean], - [LevelCrestStructureStandardDeviation], - [FlowWidthAtBottomProtectionMean], - [FlowWidthAtBottomProtectionStandardDeviation], - [CriticalOvertoppingDischargeMean], - [CriticalOvertoppingDischargeCoefficientOfVariation], - [WidthFlowAperturesMean], - [WidthFlowAperturesStandardDeviation], - [FailureProbabilityStructureWithErosion], - [StorageStructureAreaMean], - [StorageStructureAreaCoefficientOfVariation], - [AllowedLevelIncreaseStorageMean], + [HeightStructureEntityId], + [FailureMechanismEntityId], + [Order], + [Name], + CASE WHEN Suffix THEN [Id] || '(' || Suffix || ')' ELSE [Id] END as [Id], + [X], + [Y], + [StructureNormalOrientation], + [LevelCrestStructureMean], + [LevelCrestStructureStandardDeviation], + [FlowWidthAtBottomProtectionMean], + [FlowWidthAtBottomProtectionStandardDeviation], + [CriticalOvertoppingDischargeMean], + [CriticalOvertoppingDischargeCoefficientOfVariation], + [WidthFlowAperturesMean], + [WidthFlowAperturesStandardDeviation], + [FailureProbabilityStructureWithErosion], + [StorageStructureAreaMean], + [StorageStructureAreaCoefficientOfVariation], + [AllowedLevelIncreaseStorageMean], [AllowedLevelIncreaseStorageStandardDeviation] FROM (SELECT *, (SELECT count(*) FROM [SOURCEPROJECT].HeightStructureEntity Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject171.rtd =================================================================== diff -u -r6b20f88a2f50fb210b0458b7268a325f2a8d5391 -rc96dfce6fc55cd553d4abe87703f7c17ec35c393 Binary files differ Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject172.rtd =================================================================== diff -u -r6b20f88a2f50fb210b0458b7268a325f2a8d5391 -rc96dfce6fc55cd553d4abe87703f7c17ec35c393 Binary files differ Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs =================================================================== diff -u -r6b20f88a2f50fb210b0458b7268a325f2a8d5391 -rc96dfce6fc55cd553d4abe87703f7c17ec35c393 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision 6b20f88a2f50fb210b0458b7268a325f2a8d5391) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/MigrationTo172IntegrationTest.cs (.../MigrationTo172IntegrationTest.cs) (revision c96dfce6fc55cd553d4abe87703f7c17ec35c393) @@ -60,6 +60,8 @@ { AssertTablesContentMigrated(reader, sourceFilePath); + AssertHeightStructuresFailureMechanism(reader); + AssertVersions(reader); AssertDatabase(reader); } @@ -135,6 +137,31 @@ } } + private static void AssertHeightStructuresFailureMechanism(MigratedDatabaseReader reader) + { + const string validateSourcePathNull = + "SELECT COUNT() = 0 FROM ( " + + "SELECT[HeightStructuresFailureMechanismMetaEntityId] " + + "FROM HeightStructuresFailureMechanismMetaEntity WHERE [HeightStructureCollectionSourcePath] IS NULL " + + "EXCEPT " + + "SELECT[HeightStructuresFailureMechanismMetaEntityId] " + + "FROM HeightStructuresFailureMechanismMetaEntity HSFM " + + "WHERE HSFM.[FailureMechanismEntityId] NOT IN (SELECT FailureMechanismEntityId FROM HeightStructureEntity HS) " + + "); "; + reader.AssertReturnedDataIsValid(validateSourcePathNull); + + const string validateSourcePathSet = + "SELECT COUNT() = 0 FROM ( " + + "SELECT[HeightStructuresFailureMechanismMetaEntityId] " + + "FROM HeightStructuresFailureMechanismMetaEntity WHERE [HeightStructureCollectionSourcePath] = \"Onbekend\" " + + "EXCEPT " + + "SELECT[HeightStructuresFailureMechanismMetaEntityId] " + + "FROM HeightStructuresFailureMechanismMetaEntity HSFM " + + "WHERE HSFM.[FailureMechanismEntityId] IN(SELECT FailureMechanismEntityId FROM HeightStructureEntity HS) " + + "); "; + reader.AssertReturnedDataIsValid(validateSourcePathSet); + } + private static void AssertLogDatabase(string logFilePath) { using (var reader = new MigrationLogDatabaseReader(logFilePath))