Index: Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_18.1_19.1.sql
===================================================================
diff -u -r944ee0f4a7759c1fa21f4b60fd0e0ddfa319d377 -r18db2b511b48fcfb89710dd852b3ca9fb0b83b55
--- Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_18.1_19.1.sql (.../Migration_18.1_19.1.sql) (revision 944ee0f4a7759c1fa21f4b60fd0e0ddfa319d377)
+++ Riskeer/Migration/src/Riskeer.Migration.Core/EmbeddedResources/Migration_18.1_19.1.sql (.../Migration_18.1_19.1.sql) (revision 18db2b511b48fcfb89710dd852b3ca9fb0b83b55)
@@ -71,7 +71,132 @@
INSERT INTO BackgroundDataMetaEntity SELECT * FROM [SOURCEPROJECT].BackgroundDataMetaEntity;
INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity;
INSERT INTO ClosingStructureEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureEntity;
-INSERT INTO ClosingStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresCalculationEntity;
+INSERT INTO ClosingStructuresCalculationEntity(
+ [ClosingStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ [ForeshoreProfileEntityId],
+ [HydraulicLocationEntityId],
+ [ClosingStructureEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ [UseBreakWater],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [UseForeshore],
+ [Orientation],
+ [StructureNormalOrientation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [LevelCrestStructureNotClosingMean],
+ [LevelCrestStructureNotClosingStandardDeviation],
+ [InsideWaterLevelMean],
+ [InsideWaterLevelStandardDeviation],
+ [ThresholdHeightOpenWeirMean],
+ [ThresholdHeightOpenWeirStandardDeviation],
+ [AreaFlowAperturesMean],
+ [AreaFlowAperturesStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [ProbabilityOpenStructureBeforeFlooding],
+ [FailureProbabilityOpenStructure],
+ [IdenticalApertures],
+ [FailureProbabilityReparation],
+ [InflowModelType],
+ [FailureProbabilityStructureWithErosion],
+ [DeviationWaveDirection],
+ [DrainCoefficientMean],
+ [ModelFactorSuperCriticalFlowMean],
+ [StormDurationMean],
+ [FactorStormDurationOpenStructure],
+ [ShouldIllustrationPointsBeCalculated])
+SELECT
+ [ClosingStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
+ [HydraulicLocationEntityId],
+ [ClosingStructureEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
+ [Orientation],
+ [StructureNormalOrientation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [LevelCrestStructureNotClosingMean],
+ [LevelCrestStructureNotClosingStandardDeviation],
+ [InsideWaterLevelMean],
+ [InsideWaterLevelStandardDeviation],
+ [ThresholdHeightOpenWeirMean],
+ [ThresholdHeightOpenWeirStandardDeviation],
+ [AreaFlowAperturesMean],
+ [AreaFlowAperturesStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [ProbabilityOpenStructureBeforeFlooding],
+ [FailureProbabilityOpenStructure],
+ [IdenticalApertures],
+ [FailureProbabilityReparation],
+ [InflowModelType],
+ [FailureProbabilityStructureWithErosion],
+ [DeviationWaveDirection],
+ [DrainCoefficientMean],
+ [ModelFactorSuperCriticalFlowMean],
+ [StormDurationMean],
+ [FactorStormDurationOpenStructure],
+ [ShouldIllustrationPointsBeCalculated]
+FROM [SOURCEPROJECT].ClosingStructuresCalculationEntity
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO ClosingStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresFailureMechanismMetaEntity;
INSERT INTO ClosingStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresOutputEntity;
INSERT INTO ClosingStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresSectionResultEntity;
@@ -87,7 +212,34 @@
INSERT INTO FaultTreeIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].FaultTreeIllustrationPointEntity;
INSERT INTO FaultTreeIllustrationPointStochastEntity SELECT * FROM [SOURCEPROJECT].FaultTreeIllustrationPointStochastEntity;
INSERT INTO FaultTreeSubmechanismIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].FaultTreeSubmechanismIllustrationPointEntity;
-INSERT INTO ForeshoreProfileEntity SELECT * FROM [SOURCEPROJECT].ForeshoreProfileEntity;
+INSERT INTO ForeshoreProfileEntity(
+ [ForeshoreProfileEntityId],
+ [FailureMechanismEntityId],
+ [Id],
+ [Name],
+ [Orientation],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [GeometryXml],
+ [X],
+ [Y],
+ [X0],
+ [Order])
+SELECT
+ [ForeshoreProfileEntityId],
+ [FailureMechanismEntityId],
+ [Id],
+ [Name],
+ [Orientation],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [GeometryXml],
+ [X],
+ [Y],
+ [X0],
+ [Order]
+FROM [SOURCEPROJECT].ForeshoreProfileEntity
+WHERE (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) != 1;
INSERT INTO GeneralResultFaultTreeIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].GeneralResultFaultTreeIllustrationPointEntity;
INSERT INTO GeneralResultFaultTreeIllustrationPointStochastEntity SELECT * FROM [SOURCEPROJECT].GeneralResultFaultTreeIllustrationPointStochastEntity;
INSERT INTO GeneralResultSubMechanismIllustrationPointEntity SELECT * FROM [SOURCEPROJECT].GeneralResultSubMechanismIllustrationPointEntity;
@@ -123,15 +275,40 @@
SELECT
[GrassCoverErosionOutwardsWaveConditionsCalculationEntityId],
[CalculationGroupEntityId],
- [ForeshoreProfileEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
[HydraulicLocationEntityId],
[Order],
[Name],
[Comments],
- [UseBreakWater],
- [BreakWaterType],
- [BreakWaterHeight],
- [UseForeshore],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
[Orientation],
[UpperBoundaryRevetment],
[LowerBoundaryRevetment],
@@ -156,7 +333,17 @@
FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsCalculationEntity
LEFT JOIN [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsOutputEntity USING(GrassCoverErosionOutwardsWaveConditionsCalculationEntityId)
GROUP BY GrassCoverErosionOutwardsWaveConditionsCalculationEntityId
-) USING(GrassCoverErosionOutwardsWaveConditionsCalculationEntityId);
+) USING(GrassCoverErosionOutwardsWaveConditionsCalculationEntityId)
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO GrassCoverErosionOutwardsWaveConditionsOutputEntity (
[GrassCoverErosionOutwardsWaveConditionsOutputEntityId],
[GrassCoverErosionOutwardsWaveConditionsCalculationEntityId],
@@ -191,7 +378,104 @@
INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity;
INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity;
INSERT INTO HeightStructureEntity SELECT * FROM [SOURCEPROJECT].HeightStructureEntity;
-INSERT INTO HeightStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresCalculationEntity;
+INSERT INTO HeightStructuresCalculationEntity (
+ [HeightStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ [HydraulicLocationEntityId],
+ [HeightStructureEntityId],
+ [ForeshoreProfileEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ [ModelFactorSuperCriticalFlowMean],
+ [StructureNormalOrientation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FailureProbabilityStructureWithErosion],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [StormDurationMean],
+ [LevelCrestStructureMean],
+ [LevelCrestStructureStandardDeviation],
+ [DeviationWaveDirection],
+ [UseBreakWater],
+ [UseForeshore],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [ShouldIllustrationPointsBeCalculated])
+SELECT
+ [HeightStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ [HydraulicLocationEntityId],
+ [HeightStructureEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
+ [Order],
+ [Name],
+ [Comments],
+ [ModelFactorSuperCriticalFlowMean],
+ [StructureNormalOrientation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FailureProbabilityStructureWithErosion],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [StormDurationMean],
+ [LevelCrestStructureMean],
+ [LevelCrestStructureStandardDeviation],
+ [DeviationWaveDirection],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ [ShouldIllustrationPointsBeCalculated]
+FROM [SOURCEPROJECT].HeightStructuresCalculationEntity
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO HeightStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresFailureMechanismMetaEntity;
INSERT INTO HeightStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresOutputEntity;
INSERT INTO HeightStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresSectionResultEntity;
@@ -272,7 +556,170 @@
INSERT INTO PipingStructureSectionResultEntity SELECT * FROM [SOURCEPROJECT].PipingStructureSectionResultEntity;
INSERT INTO ProjectEntity SELECT * FROM [SOURCEPROJECT].ProjectEntity;
INSERT INTO StabilityPointStructureEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructureEntity;
-INSERT INTO StabilityPointStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresCalculationEntity;
+INSERT INTO StabilityPointStructuresCalculationEntity(
+ [StabilityPointStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ [ForeshoreProfileEntityId],
+ [HydraulicLocationEntityId],
+ [StabilityPointStructureEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ [UseBreakWater],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [UseForeshore],
+ [StructureNormalOrientation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [InsideWaterLevelMean],
+ [InsideWaterLevelStandardDeviation],
+ [ThresholdHeightOpenWeirMean],
+ [ThresholdHeightOpenWeirStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [ConstructiveStrengthLinearLoadModelMean],
+ [ConstructiveStrengthLinearLoadModelCoefficientOfVariation],
+ [ConstructiveStrengthQuadraticLoadModelMean],
+ [ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation],
+ [BankWidthMean],
+ [BankWidthStandardDeviation],
+ [InsideWaterLevelFailureConstructionMean],
+ [InsideWaterLevelFailureConstructionStandardDeviation],
+ [EvaluationLevel],
+ [LevelCrestStructureMean],
+ [LevelCrestStructureStandardDeviation],
+ [VerticalDistance],
+ [FailureProbabilityRepairClosure],
+ [FailureCollisionEnergyMean],
+ [FailureCollisionEnergyCoefficientOfVariation],
+ [ShipMassMean],
+ [ShipMassCoefficientOfVariation],
+ [ShipVelocityMean],
+ [ShipVelocityCoefficientOfVariation],
+ [LevellingCount],
+ [ProbabilityCollisionSecondaryStructure],
+ [FlowVelocityStructureClosableMean],
+ [StabilityLinearLoadModelMean],
+ [StabilityLinearLoadModelCoefficientOfVariation],
+ [StabilityQuadraticLoadModelMean],
+ [StabilityQuadraticLoadModelCoefficientOfVariation],
+ [AreaFlowAperturesMean],
+ [AreaFlowAperturesStandardDeviation],
+ [InflowModelType],
+ [LoadSchematizationType],
+ [VolumicWeightWater],
+ [StormDurationMean],
+ [FactorStormDurationOpenStructure],
+ [DrainCoefficientMean],
+ [FailureProbabilityStructureWithErosion],
+ [ShouldIllustrationPointsBeCalculated])
+SELECT
+ [StabilityPointStructuresCalculationEntityId],
+ [CalculationGroupEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
+ [HydraulicLocationEntityId],
+ [StabilityPointStructureEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
+ [StructureNormalOrientation],
+ [StorageStructureAreaMean],
+ [StorageStructureAreaCoefficientOfVariation],
+ [AllowedLevelIncreaseStorageMean],
+ [AllowedLevelIncreaseStorageStandardDeviation],
+ [WidthFlowAperturesMean],
+ [WidthFlowAperturesStandardDeviation],
+ [InsideWaterLevelMean],
+ [InsideWaterLevelStandardDeviation],
+ [ThresholdHeightOpenWeirMean],
+ [ThresholdHeightOpenWeirStandardDeviation],
+ [CriticalOvertoppingDischargeMean],
+ [CriticalOvertoppingDischargeCoefficientOfVariation],
+ [FlowWidthAtBottomProtectionMean],
+ [FlowWidthAtBottomProtectionStandardDeviation],
+ [ConstructiveStrengthLinearLoadModelMean],
+ [ConstructiveStrengthLinearLoadModelCoefficientOfVariation],
+ [ConstructiveStrengthQuadraticLoadModelMean],
+ [ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation],
+ [BankWidthMean],
+ [BankWidthStandardDeviation],
+ [InsideWaterLevelFailureConstructionMean],
+ [InsideWaterLevelFailureConstructionStandardDeviation],
+ [EvaluationLevel],
+ [LevelCrestStructureMean],
+ [LevelCrestStructureStandardDeviation],
+ [VerticalDistance],
+ [FailureProbabilityRepairClosure],
+ [FailureCollisionEnergyMean],
+ [FailureCollisionEnergyCoefficientOfVariation],
+ [ShipMassMean],
+ [ShipMassCoefficientOfVariation],
+ [ShipVelocityMean],
+ [ShipVelocityCoefficientOfVariation],
+ [LevellingCount],
+ [ProbabilityCollisionSecondaryStructure],
+ [FlowVelocityStructureClosableMean],
+ [StabilityLinearLoadModelMean],
+ [StabilityLinearLoadModelCoefficientOfVariation],
+ [StabilityQuadraticLoadModelMean],
+ [StabilityQuadraticLoadModelCoefficientOfVariation],
+ [AreaFlowAperturesMean],
+ [AreaFlowAperturesStandardDeviation],
+ [InflowModelType],
+ [LoadSchematizationType],
+ [VolumicWeightWater],
+ [StormDurationMean],
+ [FactorStormDurationOpenStructure],
+ [DrainCoefficientMean],
+ [FailureProbabilityStructureWithErosion],
+ [ShouldIllustrationPointsBeCalculated]
+FROM [SOURCEPROJECT].StabilityPointStructuresCalculationEntity
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO StabilityPointStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresFailureMechanismMetaEntity;
INSERT INTO StabilityPointStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresOutputEntity;
INSERT INTO StabilityPointStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresSectionResultEntity;
@@ -300,15 +747,40 @@
[CalculationType])
SELECT [StabilityStoneCoverWaveConditionsCalculationEntityId],
[CalculationGroupEntityId],
- [ForeshoreProfileEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
[HydraulicLocationEntityId],
[Order],
[Name],
[Comments],
- [UseBreakWater],
- [BreakWaterType],
- [BreakWaterHeight],
- [UseForeshore],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
[Orientation],
[UpperBoundaryRevetment],
[LowerBoundaryRevetment],
@@ -317,7 +789,17 @@
[StepSize],
[CategoryType],
3
-FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity;
+FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO StabilityStoneCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsOutputEntity;
INSERT INTO StochastEntity SELECT * FROM [SOURCEPROJECT].StochastEntity;
INSERT INTO StochasticSoilModelEntity SELECT * FROM [SOURCEPROJECT].StochasticSoilModelEntity;
@@ -341,7 +823,80 @@
FROM [SOURCEPROJECT].VersionEntity;
INSERT INTO WaveImpactAsphaltCoverFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverFailureMechanismMetaEntity;
INSERT INTO WaveImpactAsphaltCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverSectionResultEntity;
-INSERT INTO WaveImpactAsphaltCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsCalculationEntity;
+INSERT INTO WaveImpactAsphaltCoverWaveConditionsCalculationEntity(
+ [WaveImpactAsphaltCoverWaveConditionsCalculationEntityId],
+ [CalculationGroupEntityId],
+ [ForeshoreProfileEntityId],
+ [HydraulicLocationEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ [UseBreakWater],
+ [BreakWaterType],
+ [BreakWaterHeight],
+ [UseForeshore],
+ [Orientation],
+ [UpperBoundaryRevetment],
+ [LowerBoundaryRevetment],
+ [UpperBoundaryWaterLevels],
+ [LowerBoundaryWaterLevels],
+ [StepSize],
+ [CategoryType])
+SELECT
+ [WaveImpactAsphaltCoverWaveConditionsCalculationEntityId],
+ [CalculationGroupEntityId],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [ForeshoreProfileEntityId]
+ END,
+ [HydraulicLocationEntityId],
+ [Order],
+ [Name],
+ [Comments],
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseBreakWater]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 3
+ ELSE
+ [BreakWaterType]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN NULL
+ ELSE
+ [BreakWaterHeight]
+ END,
+ CASE
+ WHEN ValidForeshoreProfile = 0
+ THEN 0
+ ELSE
+ [UseForeshore]
+ END,
+ [Orientation],
+ [UpperBoundaryRevetment],
+ [LowerBoundaryRevetment],
+ [UpperBoundaryWaterLevels],
+ [LowerBoundaryWaterLevels],
+ [StepSize],
+ [CategoryType]
+FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsCalculationEntity
+LEFT JOIN (
+ SELECT
+ ForeshoreProfileEntityId,
+ CASE
+ WHEN (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / (LENGTH('') + LENGTH('')) = 1
+ THEN 0
+ ELSE 1
+ END AS ValidForeshoreProfile
+ FROM [SOURCEPROJECT].ForeshoreProfileEntity
+) USING(ForeshoreProfileEntityId);
INSERT INTO WaveImpactAsphaltCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsOutputEntity;
/*
Index: Riskeer/Migration/test/Riskeer.Migration.Core.Test/test-data/MigrationTestProject181.rtd
===================================================================
diff -u -rf0069bfffef3d60ae88b8e6ed6ed42fc131e075d -r18db2b511b48fcfb89710dd852b3ca9fb0b83b55
Binary files differ
Index: Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo191IntegrationTest.cs
===================================================================
diff -u -r944ee0f4a7759c1fa21f4b60fd0e0ddfa319d377 -r18db2b511b48fcfb89710dd852b3ca9fb0b83b55
--- Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo191IntegrationTest.cs (.../MigrationTo191IntegrationTest.cs) (revision 944ee0f4a7759c1fa21f4b60fd0e0ddfa319d377)
+++ Riskeer/Migration/test/Riskeer.Migration.Integration.Test/MigrationTo191IntegrationTest.cs (.../MigrationTo191IntegrationTest.cs) (revision 18db2b511b48fcfb89710dd852b3ca9fb0b83b55)
@@ -63,12 +63,19 @@
AssertAssessmentSection(reader, sourceFilePath);
AssertBackgroundData(reader, sourceFilePath);
+ AssertForeshoreProfile(reader, sourceFilePath);
+
AssertPipingSoilLayers(reader);
- AssertGrassCoverErosionOutwardsWaveConditionsCalculations(reader, sourceFilePath);
+// AssertGrassCoverErosionOutwardsWaveConditionsCalculations(reader, sourceFilePath);
AssertGrassCoverErosionOutwardsWaveConditionsOutput(reader, sourceFilePath);
AssertStabilityStoneCoverWaveConditionsCalculations(reader, sourceFilePath);
+ AssertWaveImpactAsphaltCoverWaveConditionsCalculations(reader, sourceFilePath);
+
+ AssertHeightStructuresCalculation(reader, sourceFilePath);
+ AssertClosingStructuresCalculation(reader, sourceFilePath);
+ AssertStabilityPointStructuresCalculations(reader, sourceFilePath);
}
AssertLogDatabase(logFilePath);
@@ -162,35 +169,6 @@
reader.AssertReturnedDataIsValid(validateBackgroundData);
}
- private static void AssertStabilityStoneCoverWaveConditionsCalculations(MigratedDatabaseReader reader, string sourceFilePath)
- {
- string validateCalculations =
- $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT;" +
- "SELECT COUNT() = (SELECT COUNT() FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity) " +
- "FROM StabilityStoneCoverWaveConditionsCalculationEntity NEW " +
- "JOIN [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity OLD USING(StabilityStoneCoverWaveConditionsCalculationEntityId) " +
- "WHERE NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
- "AND NEW.[ForeshoreProfileEntityId] IS OLD.[ForeshoreProfileEntityId] " +
- "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
- "AND NEW.\"Order\" = OLD.\"Order\" " +
- "AND NEW.[Name] IS OLD.[Name] " +
- "AND NEW.[Comments] IS OLD.[Comments] " +
- "AND NEW.[UseBreakWater] = OLD.[UseBreakWater] " +
- "AND NEW.[BreakWaterType] = OLD.[BreakWaterType] " +
- "AND NEW.[BreakWaterHeight] IS OLD.[BreakWaterHeight] " +
- "AND NEW.[UseForeshore] = OLD.[UseForeshore] " +
- "AND NEW.[Orientation] IS OLD.[Orientation] " +
- "AND NEW.[UpperBoundaryRevetment] IS OLD.[UpperBoundaryRevetment] " +
- "AND NEW.[LowerBoundaryRevetment] IS OLD.[LowerBoundaryRevetment] " +
- "AND NEW.[UpperBoundaryWaterLevels] IS OLD.[UpperBoundaryWaterLevels] " +
- "AND NEW.[LowerBoundaryWaterLevels] IS OLD.[LowerBoundaryWaterLevels] " +
- "AND NEW.[StepSize] = OLD.[StepSize] " +
- "AND NEW.[CategoryType] = OLD.[CategoryType] " +
- "AND NEW.[CalculationType] = 3;" +
- "DETACH SOURCEPROJECT;";
- reader.AssertReturnedDataIsValid(validateCalculations);
- }
-
private static void AssertGrassCoverErosionOutwardsWaveConditionsCalculations(MigratedDatabaseReader reader, string sourceFilePath)
{
string validateCalculations =
@@ -271,6 +249,461 @@
reader.AssertReturnedDataIsValid(validateOutputs);
}
+ private static void AssertForeshoreProfile(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ string validateForeshoreProfile =
+ $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " +
+ "SELECT COUNT() = " +
+ "(" +
+ "SELECT COUNT() " +
+ "FROM SOURCEPROJECT.ForeshoreProfileEntity " +
+ "WHERE (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / " +
+ "(LENGTH('') + LENGTH('')) != 1 " +
+ ") " +
+ "FROM ForeshoreProfileEntity NEW " +
+ "JOIN SOURCEPROJECT.ForeshoreProfileEntity OLD USING(ForeshoreProfileEntityId) " +
+ "WHERE NEW.[FailureMechanismEntityId] = OLD.[FailureMechanismEntityId] " +
+ "AND NEW.[Id] = OLD.[Id] " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation] " +
+ "AND NEW.[BreakWaterType] IS OLD.[BreakWaterType] " +
+ "AND NEW.[BreakWaterHeight] IS OLD.[BreakWaterHeight] " +
+ "AND NEW.[GeometryXml] = OLD.[GeometryXml] " +
+ "AND NEW.[X] IS OLD.[X] " +
+ "AND NEW.[Y] IS OLD.[Y] " +
+ "AND NEW.[X0] IS OLD.[X0] " +
+ "AND NEW.\"Order\" = OLD.\"Order\";" +
+ "DETACH SOURCEPROJECT;";
+ reader.AssertReturnedDataIsValid(validateForeshoreProfile);
+ }
+
+ private static void AssertStabilityStoneCoverWaveConditionsCalculations(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ const string calculationEntityName = "StabilityStoneCoverWaveConditionsCalculationEntity";
+ const string validForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation] " +
+ "AND NEW.[UpperBoundaryRevetment] IS OLD.[UpperBoundaryRevetment] " +
+ "AND NEW.[LowerBoundaryRevetment] IS OLD.[LowerBoundaryRevetment] " +
+ "AND NEW.[UpperBoundaryWaterLevels] IS OLD.[UpperBoundaryWaterLevels] " +
+ "AND NEW.[LowerBoundaryWaterLevels] IS OLD.[LowerBoundaryWaterLevels] " +
+ "AND NEW.[StepSize] = OLD.[StepSize] " +
+ "AND NEW.[CategoryType] = OLD.[CategoryType] " +
+ "AND NEW.[CalculationType] = 3; ";
+
+ AssertCalculationsWithValidForeshoreProfile(reader, sourceFilePath, calculationEntityName, validForeshoreProfileCriteria);
+
+ const string invalidForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation] " +
+ "AND NEW.[UpperBoundaryRevetment] IS OLD.[UpperBoundaryRevetment] " +
+ "AND NEW.[LowerBoundaryRevetment] IS OLD.[LowerBoundaryRevetment] " +
+ "AND NEW.[UpperBoundaryWaterLevels] IS OLD.[UpperBoundaryWaterLevels] " +
+ "AND NEW.[LowerBoundaryWaterLevels] IS OLD.[LowerBoundaryWaterLevels] " +
+ "AND NEW.[StepSize] = OLD.[StepSize] " +
+ "AND NEW.[CategoryType] = OLD.[CategoryType] " +
+ "AND NEW.[CalculationType] = 3; ";
+
+ AssertCalculationsWithInvalidForeshoreProfile(reader, sourceFilePath, calculationEntityName, invalidForeshoreProfileCriteria);
+ }
+
+ private static void AssertWaveImpactAsphaltCoverWaveConditionsCalculations(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ const string calculationEntityName = "StabilityStoneCoverWaveConditionsCalculationEntity";
+ const string validForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[UseBreakWater] = OLD.[UseBreakWater] " +
+ "AND NEW.[UpperBoundaryRevetment] IS OLD.[UpperBoundaryRevetment] " +
+ "AND NEW.[LowerBoundaryRevetment] IS OLD.[LowerBoundaryRevetment] " +
+ "AND NEW.[UpperBoundaryWaterLevels] IS OLD.[UpperBoundaryWaterLevels] " +
+ "AND NEW.[LowerBoundaryWaterLevels] IS OLD.[LowerBoundaryWaterLevels] " +
+ "AND NEW.[StepSize] = OLD.[StepSize] " +
+ "AND NEW.[CategoryType] = OLD.[CategoryType]; ";
+
+ AssertCalculationsWithValidForeshoreProfile(reader, sourceFilePath, calculationEntityName, validForeshoreProfileCriteria);
+
+ const string invalidForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation] " +
+ "AND NEW.[UpperBoundaryRevetment] IS OLD.[UpperBoundaryRevetment] " +
+ "AND NEW.[LowerBoundaryRevetment] IS OLD.[LowerBoundaryRevetment] " +
+ "AND NEW.[UpperBoundaryWaterLevels] IS OLD.[UpperBoundaryWaterLevels] " +
+ "AND NEW.[LowerBoundaryWaterLevels] IS OLD.[LowerBoundaryWaterLevels] " +
+ "AND NEW.[StepSize] = OLD.[StepSize] " +
+ "AND NEW.[CategoryType] = OLD.[CategoryType]; ";
+
+ AssertCalculationsWithInvalidForeshoreProfile(reader, sourceFilePath, calculationEntityName, invalidForeshoreProfileCriteria);
+ }
+
+ private static void AssertHeightStructuresCalculation(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ const string calculationEntityName = "HeightStructuresCalculationEntity";
+ const string validForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[HeightStructureEntityId] IS OLD.[HeightStructureEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[ModelFactorSuperCriticalFlowMean] IS OLD.[ModelFactorSuperCriticalFlowMean] " +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] IS OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[LevelCrestStructureMean] IS OLD.[LevelCrestStructureMean] " +
+ "AND NEW.[LevelCrestStructureStandardDeviation] IS OLD.[LevelCrestStructureStandardDeviation] " +
+ "AND NEW.[DeviationWaveDirection] IS OLD.[DeviationWaveDirection] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithValidForeshoreProfile(reader, sourceFilePath, calculationEntityName, validForeshoreProfileCriteria);
+
+ const string invalidForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[HeightStructureEntityId] IS OLD.[HeightStructureEntityId] " +
+ "AND NEW.\"Order\" = OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[ModelFactorSuperCriticalFlowMean] IS OLD.[ModelFactorSuperCriticalFlowMean] " +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] IS OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[LevelCrestStructureMean] IS OLD.[LevelCrestStructureMean] " +
+ "AND NEW.[LevelCrestStructureStandardDeviation] IS OLD.[LevelCrestStructureStandardDeviation] " +
+ "AND NEW.[DeviationWaveDirection] IS OLD.[DeviationWaveDirection] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithInvalidForeshoreProfile(reader, sourceFilePath, calculationEntityName, invalidForeshoreProfileCriteria);
+ }
+
+ private static void AssertClosingStructuresCalculation(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ const string calculationEntityName = "ClosingStructuresCalculationEntity";
+ const string validForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[ClosingStructureEntityId] IS OLD.[ClosingStructureEntityId] " +
+ "AND NEW.\"Order\" IS OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation]" +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[LevelCrestStructureNotClosingMean] IS OLD.[LevelCrestStructureNotClosingMean] " +
+ "AND NEW.[LevelCrestStructureNotClosingStandardDeviation] IS OLD.[LevelCrestStructureNotClosingStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelMean] IS OLD.[InsideWaterLevelMean] " +
+ "AND NEW.[InsideWaterLevelStandardDeviation] IS OLD.[InsideWaterLevelStandardDeviation] " +
+ "AND NEW.[ThresholdHeightOpenWeirMean] IS OLD.[ThresholdHeightOpenWeirMean] " +
+ "AND NEW.[ThresholdHeightOpenWeirStandardDeviation] IS OLD.[ThresholdHeightOpenWeirStandardDeviation] " +
+ "AND NEW.[AreaFlowAperturesMean] IS OLD.[AreaFlowAperturesMean] " +
+ "AND NEW.[AreaFlowAperturesStandardDeviation] IS OLD.[AreaFlowAperturesStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[ProbabilityOpenStructureBeforeFlooding] = OLD.[ProbabilityOpenStructureBeforeFlooding] " +
+ "AND NEW.[FailureProbabilityOpenStructure] = OLD.[FailureProbabilityOpenStructure] " +
+ "AND NEW.[IdenticalApertures] = OLD.[IdenticalApertures] " +
+ "AND NEW.[FailureProbabilityReparation] = OLD.[FailureProbabilityReparation] " +
+ "AND NEW.[InflowModelType] = OLD.[InflowModelType] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] = OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[DeviationWaveDirection] IS OLD.[DeviationWaveDirection] " +
+ "AND NEW.[DrainCoefficientMean] IS OLD.[DrainCoefficientMean] " +
+ "AND NEW.[ModelFactorSuperCriticalFlowMean] IS OLD.[ModelFactorSuperCriticalFlowMean] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[FactorStormDurationOpenStructure] IS OLD.[FactorStormDurationOpenStructure] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithValidForeshoreProfile(reader, sourceFilePath, calculationEntityName, validForeshoreProfileCriteria);
+
+ const string invalidForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[ClosingStructureEntityId] IS OLD.[ClosingStructureEntityId] " +
+ "AND NEW.\"Order\" IS OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[Orientation] IS OLD.[Orientation]" +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[LevelCrestStructureNotClosingMean] IS OLD.[LevelCrestStructureNotClosingMean] " +
+ "AND NEW.[LevelCrestStructureNotClosingStandardDeviation] IS OLD.[LevelCrestStructureNotClosingStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelMean] IS OLD.[InsideWaterLevelMean] " +
+ "AND NEW.[InsideWaterLevelStandardDeviation] IS OLD.[InsideWaterLevelStandardDeviation] " +
+ "AND NEW.[ThresholdHeightOpenWeirMean] IS OLD.[ThresholdHeightOpenWeirMean] " +
+ "AND NEW.[ThresholdHeightOpenWeirStandardDeviation] IS OLD.[ThresholdHeightOpenWeirStandardDeviation] " +
+ "AND NEW.[AreaFlowAperturesMean] IS OLD.[AreaFlowAperturesMean] " +
+ "AND NEW.[AreaFlowAperturesStandardDeviation] IS OLD.[AreaFlowAperturesStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[ProbabilityOpenStructureBeforeFlooding] = OLD.[ProbabilityOpenStructureBeforeFlooding] " +
+ "AND NEW.[FailureProbabilityOpenStructure] = OLD.[FailureProbabilityOpenStructure] " +
+ "AND NEW.[IdenticalApertures] = OLD.[IdenticalApertures] " +
+ "AND NEW.[FailureProbabilityReparation] = OLD.[FailureProbabilityReparation] " +
+ "AND NEW.[InflowModelType] = OLD.[InflowModelType] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] = OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[DeviationWaveDirection] IS OLD.[DeviationWaveDirection] " +
+ "AND NEW.[DrainCoefficientMean] IS OLD.[DrainCoefficientMean] " +
+ "AND NEW.[ModelFactorSuperCriticalFlowMean] IS OLD.[ModelFactorSuperCriticalFlowMean] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[FactorStormDurationOpenStructure] IS OLD.[FactorStormDurationOpenStructure] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithInvalidForeshoreProfile(reader, sourceFilePath, calculationEntityName, invalidForeshoreProfileCriteria);
+ }
+
+ private static void AssertStabilityPointStructuresCalculations(MigratedDatabaseReader reader, string sourceFilePath)
+ {
+ const string calculationEntityName = "StabilityPointStructuresCalculationEntity";
+ const string validForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[StabilityPointStructureEntityId] IS OLD.[StabilityPointStructureEntityId] " +
+ "AND NEW.\"Order\" IS OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelMean] IS OLD.[InsideWaterLevelFailureConstructionMean] " +
+ "AND NEW.[InsideWaterLevelStandardDeviation] IS OLD.[InsideWaterLevelFailureConstructionStandardDeviation] " +
+ "AND NEW.[ThresholdHeightOpenWeirMean] IS OLD.[ThresholdHeightOpenWeirMean] " +
+ "AND NEW.[ThresholdHeightOpenWeirStandardDeviation] IS OLD.[ThresholdHeightOpenWeirStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[ConstructiveStrengthLinearLoadModelMean] IS OLD.[ConstructiveStrengthLinearLoadModelMean] " +
+ "AND NEW.[ConstructiveStrengthLinearLoadModelCoefficientOfVariation] IS OLD.[ConstructiveStrengthLinearLoadModelCoefficientOfVariation] " +
+ "AND NEW.[ConstructiveStrengthQuadraticLoadModelMean] IS OLD.[ConstructiveStrengthQuadraticLoadModelMean] " +
+ "AND NEW.[ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation] IS OLD.[ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation] " +
+ "AND NEW.[BankWidthMean] IS OLD.[BankWidthMean] " +
+ "AND NEW.[BankWidthStandardDeviation] IS OLD.[BankWidthStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelFailureConstructionMean] IS OLD.[InsideWaterLevelFailureConstructionMean] " +
+ "AND NEW.[InsideWaterLevelFailureConstructionStandardDeviation] IS OLD.[InsideWaterLevelFailureConstructionStandardDeviation] " +
+ "AND NEW.[EvaluationLevel] IS OLD.[EvaluationLevel] " +
+ "AND NEW.[LevelCrestStructureMean] IS OLD.[LevelCrestStructureMean] " +
+ "AND NEW.[LevelCrestStructureStandardDeviation] IS OLD.[LevelCrestStructureStandardDeviation] " +
+ "AND NEW.[VerticalDistance] IS OLD.[VerticalDistance] " +
+ "AND NEW.[FailureProbabilityRepairClosure] = OLD.[FailureProbabilityRepairClosure] " +
+ "AND NEW.[FailureCollisionEnergyMean] IS OLD.[FailureCollisionEnergyMean] " +
+ "AND NEW.[FailureCollisionEnergyCoefficientOfVariation] IS OLD.[FailureCollisionEnergyCoefficientOfVariation] " +
+ "AND NEW.[ShipMassMean] IS OLD.[ShipMassMean] " +
+ "AND NEW.[ShipMassCoefficientOfVariation] IS OLD.[ShipMassCoefficientOfVariation] " +
+ "AND NEW.[ShipVelocityMean] IS OLD.[ShipVelocityMean] " +
+ "AND NEW.[ShipVelocityCoefficientOfVariation] IS OLD.[ShipVelocityCoefficientOfVariation] " +
+ "AND NEW.[LevellingCount] = OLD.[LevellingCount] " +
+ "AND NEW.[ProbabilityCollisionSecondaryStructure] = OLD.[ProbabilityCollisionSecondaryStructure] " +
+ "AND NEW.[FlowVelocityStructureClosableMean] IS OLD.[FlowVelocityStructureClosableMean] " +
+ "AND NEW.[StabilityLinearLoadModelMean] IS OLD.[StabilityLinearLoadModelMean] " +
+ "AND NEW.[StabilityLinearLoadModelCoefficientOfVariation] IS OLD.[StabilityLinearLoadModelCoefficientOfVariation] " +
+ "AND NEW.[StabilityQuadraticLoadModelMean] IS OLD.[StabilityQuadraticLoadModelMean] " +
+ "AND NEW.[StabilityQuadraticLoadModelCoefficientOfVariation] IS OLD.[StabilityQuadraticLoadModelCoefficientOfVariation] " +
+ "AND NEW.[AreaFlowAperturesMean] IS OLD.[AreaFlowAperturesMean] " +
+ "AND NEW.[AreaFlowAperturesStandardDeviation] IS OLD.[AreaFlowAperturesStandardDeviation] " +
+ "AND NEW.[InflowModelType] = OLD.[InflowModelType] " +
+ "AND NEW.[LoadSchematizationType] = OLD.[LoadSchematizationType] " +
+ "AND NEW.[VolumicWeightWater] IS OLD.[VolumicWeightWater] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[FactorStormDurationOpenStructure] IS OLD.[FactorStormDurationOpenStructure] " +
+ "AND NEW.[DrainCoefficientMean] IS OLD.[DrainCoefficientMean] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] IS OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithValidForeshoreProfile(reader, sourceFilePath, calculationEntityName, validForeshoreProfileCriteria);
+
+ const string invalidForeshoreProfileCriteria =
+ "NEW.[CalculationGroupEntityId] = OLD.[CalculationGroupEntityId] " +
+ "AND NEW.[HydraulicLocationEntityId] IS OLD.[HydraulicLocationEntityId] " +
+ "AND NEW.[StabilityPointStructureEntityId] IS OLD.[StabilityPointStructureEntityId] " +
+ "AND NEW.\"Order\" IS OLD.\"Order\" " +
+ "AND NEW.[Name] IS OLD.[Name] " +
+ "AND NEW.[Comments] IS OLD.[Comments] " +
+ "AND NEW.[StructureNormalOrientation] IS OLD.[StructureNormalOrientation] " +
+ "AND NEW.[StorageStructureAreaMean] IS OLD.[StorageStructureAreaMean] " +
+ "AND NEW.[StorageStructureAreaCoefficientOfVariation] IS OLD.[StorageStructureAreaCoefficientOfVariation] " +
+ "AND NEW.[AllowedLevelIncreaseStorageMean] IS OLD.[AllowedLevelIncreaseStorageMean] " +
+ "AND NEW.[AllowedLevelIncreaseStorageStandardDeviation] IS OLD.[AllowedLevelIncreaseStorageStandardDeviation] " +
+ "AND NEW.[WidthFlowAperturesMean] IS OLD.[WidthFlowAperturesMean] " +
+ "AND NEW.[WidthFlowAperturesStandardDeviation] IS OLD.[WidthFlowAperturesStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelMean] IS OLD.[InsideWaterLevelFailureConstructionMean] " +
+ "AND NEW.[InsideWaterLevelStandardDeviation] IS OLD.[InsideWaterLevelFailureConstructionStandardDeviation] " +
+ "AND NEW.[ThresholdHeightOpenWeirMean] IS OLD.[ThresholdHeightOpenWeirMean] " +
+ "AND NEW.[ThresholdHeightOpenWeirStandardDeviation] IS OLD.[ThresholdHeightOpenWeirStandardDeviation] " +
+ "AND NEW.[CriticalOvertoppingDischargeMean] IS OLD.[CriticalOvertoppingDischargeMean] " +
+ "AND NEW.[CriticalOvertoppingDischargeCoefficientOfVariation] IS OLD.[CriticalOvertoppingDischargeCoefficientOfVariation] " +
+ "AND NEW.[FlowWidthAtBottomProtectionMean] IS OLD.[FlowWidthAtBottomProtectionMean] " +
+ "AND NEW.[FlowWidthAtBottomProtectionStandardDeviation] IS OLD.[FlowWidthAtBottomProtectionStandardDeviation] " +
+ "AND NEW.[ConstructiveStrengthLinearLoadModelMean] IS OLD.[ConstructiveStrengthLinearLoadModelMean] " +
+ "AND NEW.[ConstructiveStrengthLinearLoadModelCoefficientOfVariation] IS OLD.[ConstructiveStrengthLinearLoadModelCoefficientOfVariation] " +
+ "AND NEW.[ConstructiveStrengthQuadraticLoadModelMean] IS OLD.[ConstructiveStrengthQuadraticLoadModelMean] " +
+ "AND NEW.[ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation] IS OLD.[ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation] " +
+ "AND NEW.[BankWidthMean] IS OLD.[BankWidthMean] " +
+ "AND NEW.[BankWidthStandardDeviation] IS OLD.[BankWidthStandardDeviation] " +
+ "AND NEW.[InsideWaterLevelFailureConstructionMean] IS OLD.[InsideWaterLevelFailureConstructionMean] " +
+ "AND NEW.[InsideWaterLevelFailureConstructionStandardDeviation] IS OLD.[InsideWaterLevelFailureConstructionStandardDeviation] " +
+ "AND NEW.[EvaluationLevel] IS OLD.[EvaluationLevel] " +
+ "AND NEW.[LevelCrestStructureMean] IS OLD.[LevelCrestStructureMean] " +
+ "AND NEW.[LevelCrestStructureStandardDeviation] IS OLD.[LevelCrestStructureStandardDeviation] " +
+ "AND NEW.[VerticalDistance] IS OLD.[VerticalDistance] " +
+ "AND NEW.[FailureProbabilityRepairClosure] = OLD.[FailureProbabilityRepairClosure] " +
+ "AND NEW.[FailureCollisionEnergyMean] IS OLD.[FailureCollisionEnergyMean] " +
+ "AND NEW.[FailureCollisionEnergyCoefficientOfVariation] IS OLD.[FailureCollisionEnergyCoefficientOfVariation] " +
+ "AND NEW.[ShipMassMean] IS OLD.[ShipMassMean] " +
+ "AND NEW.[ShipMassCoefficientOfVariation] IS OLD.[ShipMassCoefficientOfVariation] " +
+ "AND NEW.[ShipVelocityMean] IS OLD.[ShipVelocityMean] " +
+ "AND NEW.[ShipVelocityCoefficientOfVariation] IS OLD.[ShipVelocityCoefficientOfVariation] " +
+ "AND NEW.[LevellingCount] = OLD.[LevellingCount] " +
+ "AND NEW.[ProbabilityCollisionSecondaryStructure] = OLD.[ProbabilityCollisionSecondaryStructure] " +
+ "AND NEW.[FlowVelocityStructureClosableMean] IS OLD.[FlowVelocityStructureClosableMean] " +
+ "AND NEW.[StabilityLinearLoadModelMean] IS OLD.[StabilityLinearLoadModelMean] " +
+ "AND NEW.[StabilityLinearLoadModelCoefficientOfVariation] IS OLD.[StabilityLinearLoadModelCoefficientOfVariation] " +
+ "AND NEW.[StabilityQuadraticLoadModelMean] IS OLD.[StabilityQuadraticLoadModelMean] " +
+ "AND NEW.[StabilityQuadraticLoadModelCoefficientOfVariation] IS OLD.[StabilityQuadraticLoadModelCoefficientOfVariation] " +
+ "AND NEW.[AreaFlowAperturesMean] IS OLD.[AreaFlowAperturesMean] " +
+ "AND NEW.[AreaFlowAperturesStandardDeviation] IS OLD.[AreaFlowAperturesStandardDeviation] " +
+ "AND NEW.[InflowModelType] = OLD.[InflowModelType] " +
+ "AND NEW.[LoadSchematizationType] = OLD.[LoadSchematizationType] " +
+ "AND NEW.[VolumicWeightWater] IS OLD.[VolumicWeightWater] " +
+ "AND NEW.[StormDurationMean] IS OLD.[StormDurationMean] " +
+ "AND NEW.[FactorStormDurationOpenStructure] IS OLD.[FactorStormDurationOpenStructure] " +
+ "AND NEW.[DrainCoefficientMean] IS OLD.[DrainCoefficientMean] " +
+ "AND NEW.[FailureProbabilityStructureWithErosion] IS OLD.[FailureProbabilityStructureWithErosion] " +
+ "AND NEW.[ShouldIllustrationPointsBeCalculated] = OLD.[ShouldIllustrationPointsBeCalculated]; ";
+
+ AssertCalculationsWithInvalidForeshoreProfile(reader, sourceFilePath, calculationEntityName, invalidForeshoreProfileCriteria);
+ }
+
+ private static void AssertCalculationsWithValidForeshoreProfile(MigratedDatabaseReader reader,
+ string sourceFilePath,
+ string calculationEntityName,
+ string criteria)
+ {
+ string validateCalculationsWithoutForeshoreProfiles =
+ $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " +
+ "SELECT COUNT() = " +
+ "(" +
+ "SELECT COUNT() " +
+ $"FROM [SOURCEPROJECT].{calculationEntityName} " +
+ "WHERE ForeshoreProfileEntityId IS NULL " +
+ ")" +
+ $"FROM {calculationEntityName} NEW " +
+ $"JOIN [SOURCEPROJECT].{calculationEntityName} OLD USING({calculationEntityName}Id)" +
+ "WHERE OLD.ForeshoreProfileEntityId IS NULL " +
+ "AND NEW.[UseBreakWater] = OLD.[UseBreakWater] " +
+ "AND NEW.[BreakWaterType] = OLD.[BreakWaterType] " +
+ "AND NEW.[BreakWaterHeight] IS OLD.[BreakWaterHeight] " +
+ "AND NEW.[UseForeshore] = OLD.[UseForeshore] " +
+ $"AND {criteria}" +
+ "DETACH SOURCEPROJECT;";
+ reader.AssertReturnedDataIsValid(validateCalculationsWithoutForeshoreProfiles);
+
+ string validateCalculationsWithValidForeshoreProfiles =
+ $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " +
+ "SELECT COUNT() = " +
+ "(" +
+ "SELECT COUNT() " +
+ $"FROM [SOURCEPROJECT].{calculationEntityName} " +
+ "JOIN [SOURCEPROJECT].ForeshoreProfileEntity USING(ForeshoreProfileEntityId)" +
+ "WHERE (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / " +
+ "(LENGTH('') + LENGTH('')) > 1" +
+ ")" +
+ $"FROM {calculationEntityName} NEW " +
+ $"JOIN [SOURCEPROJECT].{calculationEntityName} OLD USING({calculationEntityName}Id)" +
+ "JOIN [SOURCEPROJECT].ForeshoreProfileEntity FP " +
+ "WHERE OLD.ForeshoreProfileEntityId = FP.ForeshoreProfileEntityId " +
+ "AND (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / " +
+ "(LENGTH('') + LENGTH('')) > 1 " +
+ "AND NEW.[UseBreakWater] = OLD.[UseBreakWater] " +
+ "AND NEW.[BreakWaterType] = OLD.[BreakWaterType] " +
+ "AND NEW.[BreakWaterHeight] IS OLD.[BreakWaterHeight] " +
+ "AND NEW.[UseForeshore] = OLD.[UseForeshore] " +
+ $"AND {criteria}" +
+ "DETACH SOURCEPROJECT;";
+ reader.AssertReturnedDataIsValid(validateCalculationsWithValidForeshoreProfiles);
+ }
+
+ private static void AssertCalculationsWithInvalidForeshoreProfile(MigratedDatabaseReader reader,
+ string sourceFilePath,
+ string calculationEntityName,
+ string criteria)
+ {
+ string validateCalculationsWithInvalidForeshoreProfiles =
+ $"ATTACH DATABASE \"{sourceFilePath}\" AS SOURCEPROJECT; " +
+ "SELECT COUNT() = " +
+ "(" +
+ "SELECT COUNT() " +
+ $"FROM [SOURCEPROJECT].{calculationEntityName} " +
+ "JOIN [SOURCEPROJECT].ForeshoreProfileEntity USING(ForeshoreProfileEntityId)" +
+ "WHERE (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / " +
+ "(LENGTH('') + LENGTH('')) = 1" +
+ ")" +
+ $"FROM {calculationEntityName} NEW " +
+ $"JOIN [SOURCEPROJECT].{calculationEntityName} OLD USING({calculationEntityName}Id)" +
+ "JOIN [SOURCEPROJECT].ForeshoreProfileEntity FP " +
+ "WHERE OLD.ForeshoreProfileEntityId = FP.ForeshoreProfileEntityId " +
+ "AND (LENGTH(GeometryXML) - LENGTH(REPLACE(REPLACE(GeometryXML, '', ''), '', ''))) / " +
+ "(LENGTH('') + LENGTH('')) = 1 " +
+ "AND NEW.[UseBreakWater] = 0 " +
+ "AND NEW.[BreakWaterType] = 3 " +
+ "AND NEW.[BreakWaterHeight] IS NULL " +
+ "AND NEW.[UseForeshore] = 0 " +
+ $"AND {criteria}" +
+ "DETACH SOURCEPROJECT;";
+ reader.AssertReturnedDataIsValid(validateCalculationsWithInvalidForeshoreProfiles);
+ }
+
private static void AssertTablesContentMigrated(MigratedDatabaseReader reader, string sourceFilePath)
{
string[] tables =
@@ -296,7 +729,6 @@
"FaultTreeIllustrationPointEntity",
"FaultTreeIllustrationPointStochastEntity",
"FaultTreeSubmechanismIllustrationPointEntity",
- "ForeshoreProfileEntity",
"GeneralResultFaultTreeIllustrationPointEntity",
"GeneralResultFaultTreeIllustrationPointStochastEntity",
"GeneralResultSubMechanismIllustrationPointEntity",
@@ -392,7 +824,7 @@
{
ReadOnlyCollection messages = reader.GetMigrationLogMessages();
- Assert.AreEqual(14, messages.Count);
+ Assert.AreEqual(18, messages.Count);
var i = 0;
MigrationLogTestHelper.AssertMigrationLogMessageEqual(
new MigrationLogMessage("18.1", newVersion, "Gevolgen van de migratie van versie 18.1 naar versie 19.1:"),
@@ -440,6 +872,20 @@
messages[i++]);
MigrationLogTestHelper.AssertMigrationLogMessageEqual(
new MigrationLogMessage("18.1", newVersion, " + Er worden standaardwaarden conform WBI2017 gebruikt voor de HLCD bestandsinformatie."),
+ messages[i++]);
+
+ MigrationLogTestHelper.AssertMigrationLogMessageEqual(
+ new MigrationLogMessage("18.1", newVersion, "* Traject: 'InvalidDikeProfiles'"),
+ messages[i++]);
+ MigrationLogTestHelper.AssertMigrationLogMessageEqual(
+ new MigrationLogMessage("18.1", newVersion, " + Er worden standaardwaarden conform WBI2017 gebruikt voor de HLCD bestandsinformatie."),
+ messages[i++]);
+
+ MigrationLogTestHelper.AssertMigrationLogMessageEqual(
+ new MigrationLogMessage("18.1", newVersion, "* Traject: 'InvalidForeshoreProfiles'"),
+ messages[i++]);
+ MigrationLogTestHelper.AssertMigrationLogMessageEqual(
+ new MigrationLogMessage("18.1", newVersion, " + Er worden standaardwaarden conform WBI2017 gebruikt voor de HLCD bestandsinformatie."),
messages[i]);
}
}