Index: Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_21.1_21.2.sql =================================================================== diff -u -r513a3c1dd1ddd62dcdb034cdb24005ca7565662e -r89288fa576b79db12866e73438969fe15b705cda --- Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_21.1_21.2.sql (.../Migration_21.1_21.2.sql) (revision 513a3c1dd1ddd62dcdb034cdb24005ca7565662e) +++ Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_21.1_21.2.sql (.../Migration_21.1_21.2.sql) (revision 89288fa576b79db12866e73438969fe15b705cda) @@ -114,20 +114,35 @@ INSERT INTO GeneralResultFaultTreeIllustrationPointStochastEntity SELECT * FROM [SOURCEPROJECT].GeneralResultFaultTreeIllustrationPointStochastEntity; INSERT INTO GeneralResultSubMechanismIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].GeneralResultSubMechanismIllustrationPointEntity; INSERT INTO GeneralResultSubMechanismIllustrationPointStochastEntity SELECT * FROM [SOURCEPROJECT].GeneralResultSubMechanismIllustrationPointStochastEntity; -INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity; +INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity ( + [GrassCoverErosionInwardsFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [N], + [DikeProfileCollectionSourcePath], + [ApplyLengthEffectInSection] +) +SELECT + [GrassCoverErosionInwardsFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [N], + [DikeProfileCollectionSourcePath], + 0 +FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity; INSERT INTO GrassCoverErosionInwardsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsOutputEntity; INSERT INTO GrassCoverErosionInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsSectionResultEntity; INSERT INTO GrassCoverErosionOutwardsFailureMechanismMetaEntity ( [GrassCoverErosionOutwardsFailureMechanismMetaEntityId], [FailureMechanismEntityId], [N], - [ForeshoreProfileCollectionSourcePath] + [ForeshoreProfileCollectionSourcePath], + [ApplyLengthEffectInSection] ) SELECT [GrassCoverErosionOutwardsFailureMechanismMetaEntityId], [FailureMechanismEntityId], [N], - [ForeshoreProfileCollectionSourcePath] + [ForeshoreProfileCollectionSourcePath], + 0 FROM [SOURCEPROJECT].GrassCoverErosionOutwardsFailureMechanismMetaEntity; INSERT INTO GrassCoverErosionOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsSectionResultEntity; INSERT INTO GrassCoverErosionOutwardsWaveConditionsCalculationEntity ( @@ -182,19 +197,25 @@ INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity; INSERT INTO GrassCoverSlipOffInwardsFailureMechanismMetaEntity ( [FailureMechanismEntityId], - [N]) + [N], + [ApplyLengthEffectInSection] +) SELECT [FailureMechanismEntityId], - 1 + 1, + 0 FROM [SOURCEPROJECT].FailureMechanismEntity WHERE FailureMechanismType = 16; INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity; INSERT INTO GrassCoverSlipOffOutwardsFailureMechanismMetaEntity ( [FailureMechanismEntityId], - [N]) + [N], + [ApplyLengthEffectInSection] +) SELECT [FailureMechanismEntityId], - 1 + 1, + 0 FROM [SOURCEPROJECT].FailureMechanismEntity WHERE FailureMechanismType = 5; INSERT INTO HeightStructureEntity SELECT * FROM [SOURCEPROJECT].HeightStructureEntity; @@ -251,14 +272,26 @@ INSERT INTO MacroStabilityInwardsSoilProfileTwoDEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsSoilProfileTwoDEntity; INSERT INTO MacroStabilityInwardsSoilProfileTwoDSoilLayerTwoDEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsSoilProfileTwoDSoilLayerTwoDEntity; INSERT INTO MacroStabilityInwardsStochasticSoilProfileEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityInwardsStochasticSoilProfileEntity; -INSERT INTO MacroStabilityOutwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityOutwardsFailureMechanismMetaEntity; +INSERT INTO MacroStabilityOutwardsFailureMechanismMetaEntity ( + [MacroStabilityOutwardsFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [A], + [ApplyLengthEffectInSection]) +SELECT + [MacroStabilityOutwardsFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [A], + 0 +FROM [SOURCEPROJECT].MacroStabilityOutwardsFailureMechanismMetaEntity; INSERT INTO MacroStabilityOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].MacroStabilityOutwardsSectionResultEntity; INSERT INTO MicrostabilityFailureMechanismMetaEntity ( [FailureMechanismEntityId], - [N]) + [N], + [ApplyLengthEffectInSection]) SELECT [FailureMechanismEntityId], - 1 + 1, + 0 FROM [SOURCEPROJECT].FailureMechanismEntity WHERE FailureMechanismType = 14; INSERT INTO MicrostabilitySectionResultEntity SELECT * FROM [SOURCEPROJECT].MicrostabilitySectionResultEntity; @@ -331,7 +364,20 @@ INSERT INTO StabilityPointStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresFailureMechanismMetaEntity; INSERT INTO StabilityPointStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresOutputEntity; INSERT INTO StabilityPointStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresSectionResultEntity; -INSERT INTO StabilityStoneCoverFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverFailureMechanismMetaEntity; +INSERT INTO StabilityStoneCoverFailureMechanismMetaEntity ( + [StabilityStoneCoverFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [ForeshoreProfileCollectionSourcePath], + [N], + [ApplyLengthEffectInSection] +) +SELECT + [StabilityStoneCoverFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [ForeshoreProfileCollectionSourcePath], + [N], + 0 +FROM [SOURCEPROJECT].StabilityStoneCoverFailureMechanismMetaEntity; INSERT INTO StabilityStoneCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverSectionResultEntity; INSERT INTO StabilityStoneCoverWaveConditionsCalculationEntity ( [StabilityStoneCoverWaveConditionsCalculationEntityId], @@ -401,10 +447,13 @@ INSERT INTO TechnicalInnovationSectionResultEntity SELECT * FROM [SOURCEPROJECT].TechnicalInnovationSectionResultEntity; INSERT INTO TechnicalInnovationFailureMechanismMetaEntity ( [FailureMechanismEntityId], - [N]) + [N], + [ApplyLengthEffectInSection] +) SELECT [FailureMechanismEntityId], - 1 + 1, + 0 FROM [SOURCEPROJECT].FailureMechanismEntity WHERE FailureMechanismType = 18; INSERT INTO TopLevelFaultTreeIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].TopLevelFaultTreeIllustrationPointEntity; Index: Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo212IntegrationTest.cs =================================================================== diff -u -r513a3c1dd1ddd62dcdb034cdb24005ca7565662e -r89288fa576b79db12866e73438969fe15b705cda --- Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo212IntegrationTest.cs (.../MigrationTo212IntegrationTest.cs) (revision 513a3c1dd1ddd62dcdb034cdb24005ca7565662e) +++ Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo212IntegrationTest.cs (.../MigrationTo212IntegrationTest.cs) (revision 89288fa576b79db12866e73438969fe15b705cda) @@ -88,6 +88,7 @@ AssertDuneLocationCalculation(reader); AssertDuneLocationCalculationOutput(reader); + AssertStrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity(reader, sourceFilePath); AssertStandAloneFailureMechanismMetaEntity(reader, sourceFilePath); } @@ -494,7 +495,7 @@ #region StandAlone - private static void AssertStandAloneFailureMechanismMetaEntity(MigratedDatabaseReader reader, string sourceFilePath) + private static void AssertStrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity(MigratedDatabaseReader reader, string sourceFilePath) { string validateFailureMechanismMetaEntity = $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " + @@ -509,10 +510,28 @@ "AND NEW.[N] = 1;" + "DETACH SOURCEPROJECT;"; + reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "17", "StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity")); + } + + private static void AssertStandAloneFailureMechanismMetaEntity(MigratedDatabaseReader reader, string sourceFilePath) + { + string validateFailureMechanismMetaEntity = + $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " + + "SELECT COUNT() = (" + + "SELECT COUNT()" + + "FROM SOURCEPROJECT.FailureMechanismEntity " + + "WHERE FailureMechanismType = {0}" + + ") " + + "FROM {1} NEW " + + "JOIN SOURCEPROJECT.FailureMechanismEntity OLD USING(FailureMechanismEntityId) " + + "WHERE OLD.[FailureMechanismType] = {0} " + + "AND NEW.[N] = 1 " + + "AND NEW.[ApplyLengthEffectInSection] = 1;" + + "DETACH SOURCEPROJECT;"; + reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "16", "GrassCoverSlipOffInwardsFailureMechanismMetaEntity")); reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "5", "GrassCoverSlipOffOutwardsFailureMechanismMetaEntity")); reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "14", "MicrostabilityFailureMechanismMetaEntity")); - reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "17", "StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntity")); reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "18", "TechnicalInnovationFailureMechanismMetaEntity")); reader.AssertReturnedDataIsValid(string.Format(validateFailureMechanismMetaEntity, "15", "WaterPressureAsphaltCoverFailureMechanismMetaEntity")); }