/* ---------------------------------------------------- */
/*  Generated by Enterprise Architect Version 12.0 		*/
/*  Created On : 10-Apr-2017 13:58:22 				*/
/*  DBMS       : SQLite 								*/
/* ---------------------------------------------------- */

/* Drop Tables */

DROP TABLE IF EXISTS 'VersionEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsDikeHeightOutputEntity'
;

DROP TABLE IF EXISTS 'ProjectEntity'
;

DROP TABLE IF EXISTS 'StabilityPointStructuresCalculationEntity'
;

DROP TABLE IF EXISTS 'AssessmentSectionEntity'
;

DROP TABLE IF EXISTS 'FailureMechanismEntity'
;

DROP TABLE IF EXISTS 'FailureMechanismSectionEntity'
;

DROP TABLE IF EXISTS 'PipingFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'StabilityPointStructuresFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'ClosingStructuresFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'DuneErosionFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'CalculationGroupEntity'
;

DROP TABLE IF EXISTS 'HeightStructuresFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'HydraulicLocationEntity'
;

DROP TABLE IF EXISTS 'PipingCalculationEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsCalculationEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
;

DROP TABLE IF EXISTS 'SoilLayerEntity'
;

DROP TABLE IF EXISTS 'SoilProfileEntity'
;

DROP TABLE IF EXISTS 'StochasticSoilProfileEntity'
;

DROP TABLE IF EXISTS 'StochasticSoilModelEntity'
;

DROP TABLE IF EXISTS 'SurfaceLineEntity'
;

DROP TABLE IF EXISTS 'CharacteristicPointEntity'
;

DROP TABLE IF EXISTS 'PipingCalculationOutputEntity'
;

DROP TABLE IF EXISTS 'PipingSemiProbabilisticOutputEntity'
;

DROP TABLE IF EXISTS 'PipingSectionResultEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'HeightStructuresSectionResultEntity'
;

DROP TABLE IF EXISTS 'StrengthStabilityLengthwiseConstructionSectionResultEntity'
;

DROP TABLE IF EXISTS 'TechnicalInnovationSectionResultEntity'
;

DROP TABLE IF EXISTS 'WaterPressureAsphaltCoverSectionResultEntity'
;

DROP TABLE IF EXISTS 'ClosingStructuresSectionResultEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'GrassCoverSlipOffInwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'GrassCoverSlipOffOutwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'MacrostabilityInwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'MacrostabilityOutwardsSectionResultEntity'
;

DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverSectionResultEntity'
;

DROP TABLE IF EXISTS 'MicrostabilitySectionResultEntity'
;

DROP TABLE IF EXISTS 'PipingStructureSectionResultEntity'
;

DROP TABLE IF EXISTS 'DuneErosionSectionResultEntity'
;

DROP TABLE IF EXISTS 'StabilityStoneCoverSectionResultEntity'
;

DROP TABLE IF EXISTS 'StabilityPointStructuresSectionResultEntity'
;

DROP TABLE IF EXISTS 'DikeProfileEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsOutputEntity'
;

DROP TABLE IF EXISTS 'ForeshoreProfileEntity'
;

DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsCalculationEntity'
;

DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsOutputEntity'
;

DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity'
;

DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverWaveConditionsOutputEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsOutputEntity'
;

DROP TABLE IF EXISTS 'HeightStructuresOutputEntity'
;

DROP TABLE IF EXISTS 'HeightStructureEntity'
;

DROP TABLE IF EXISTS 'HeightStructuresCalculationEntity'
;

DROP TABLE IF EXISTS 'ClosingStructureEntity'
;

DROP TABLE IF EXISTS 'ClosingStructuresCalculationEntity'
;

DROP TABLE IF EXISTS 'ClosingStructuresOutputEntity'
;

DROP TABLE IF EXISTS 'StabilityPointStructureEntity'
;

DROP TABLE IF EXISTS 'StabilityPointStructuresOutputEntity'
;

DROP TABLE IF EXISTS 'HydraulicLocationOutputEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity'
;

DROP TABLE IF EXISTS 'DuneLocationEntity'
;

DROP TABLE IF EXISTS 'DuneLocationOutputEntity'
;

DROP TABLE IF EXISTS 'BackgroundDataEntity'
;

DROP TABLE IF EXISTS 'BackgroundDataMetaEntity'
;

DROP TABLE IF EXISTS 'GrassCoverErosionInwardsOvertoppingRateOutputEntity'
;

/* Create Tables with Primary and Foreign Keys, Check and Unique Constraints */

CREATE TABLE 'VersionEntity'
(
	'VersionId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'Version' VARCHAR (20) NOT NULL,
	'Timestamp' DATETIME NOT NULL,
	'FingerPrint' BLOB NOT NULL
)
;

CREATE TABLE 'GrassCoverErosionInwardsDikeHeightOutputEntity'
(
	'GrassCoverErosionInwardsDikeHeightOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'GrassCoverErosionInwardsOutputEntityId' INTEGER NOT NULL,
	'DikeHeight' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
	CONSTRAINT 'FK_GrassCoverErosionInwardsDikeHeightOutputEntity_GrassCoverErosionInwardsOutputEntity' FOREIGN KEY ('GrassCoverErosionInwardsOutputEntityId') REFERENCES 'GrassCoverErosionInwardsOutputEntity' ('GrassCoverErosionInwardsOutputEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_GrassCoverErosionInwardsOutputEntity' UNIQUE ('GrassCoverErosionInwardsOutputEntityId')
)
;

CREATE TABLE 'ProjectEntity'
(
	'ProjectEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'Description' VARCHAR (260)
)
;

CREATE TABLE 'StabilityPointStructuresCalculationEntity'
(
	'StabilityPointStructuresCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'ForeshoreProfileEntityId' INTEGER,
	'HydraulicLocationEntityId' INTEGER,
	'StabilityPointStructureEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'StructureNormalOrientation' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'InsideWaterLevelMean' REAL,
	'InsideWaterLevelStandardDeviation' REAL,
	'ThresholdHeightOpenWeirMean' REAL,
	'ThresholdHeightOpenWeirStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'ConstructiveStrengthLinearLoadModelMean' REAL,
	'ConstructiveStrengthLinearLoadModelCoefficientOfVariation' REAL,
	'ConstructiveStrengthQuadraticLoadModelMean' REAL,
	'ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation' REAL,
	'BankWidthMean' REAL,
	'BankWidthStandardDeviation' REAL,
	'InsideWaterLevelFailureConstructionMean' REAL,
	'InsideWaterLevelFailureConstructionStandardDeviation' REAL,
	'EvaluationLevel' REAL,
	'LevelCrestStructureMean' REAL,
	'LevelCrestStructureStandardDeviation' REAL,
	'VerticalDistance' REAL,
	'FailureProbabilityRepairClosure' REAL NOT NULL,
	'FailureCollisionEnergyMean' REAL,
	'FailureCollisionEnergyCoefficientOfVariation' REAL,
	'ShipMassMean' REAL,
	'ShipMassCoefficientOfVariation' REAL,
	'ShipVelocityMean' REAL,
	'ShipVelocityCoefficientOfVariation' REAL,
	'LevellingCount' INT (4) NOT NULL,
	'ProbabilityCollisionSecondaryStructure' REAL NOT NULL,
	'FlowVelocityStructureClosableMean' REAL,
	'StabilityLinearLoadModelMean' REAL,
	'StabilityLinearLoadModelCoefficientOfVariation' REAL,
	'StabilityQuadraticLoadModelMean' REAL,
	'StabilityQuadraticLoadModelCoefficientOfVariation' REAL,
	'AreaFlowAperturesMean' REAL,
	'AreaFlowAperturesStandardDeviation' REAL,
	'InflowModelType' TINYINT (1) NOT NULL, -- Enum: 1 = VerticalWall, 2 = LowSill, 3 = FloodedCulvert
	'LoadSchematizationType' TINYINT (1) NOT NULL, -- Enum: 1 = Linear, 2 = Quadratic
	'VolumicWeightWater' REAL,
	'StormDurationMean' REAL,
	'ModelFactorSuperCriticalFlowMean' REAL,
	'FactorStormDurationOpenStructure' REAL,
	'DrainCoefficientMean' REAL,
	'FailureProbabilityStructureWithErosion' REAL NOT NULL,
	CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_StabilityPointStructureEntity' FOREIGN KEY ('StabilityPointStructureEntityId') REFERENCES 'StabilityPointStructureEntity' ('StabilityPointStructureEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'AssessmentSectionEntity'
(
	'AssessmentSectionEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'ProjectEntityId' INTEGER NOT NULL,
	'Id' TEXT,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'Norm' REAL NOT NULL,
	'HydraulicDatabaseVersion' TEXT,
	'HydraulicDatabaseLocation' TEXT,
	'Composition' TINYINT (1) NOT NULL, -- Enum: 1 = Dike, 2 = Dune, 3 = DikeAndDune
	'ReferenceLinePointXml' TEXT,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_AssessmentSectionEntity_ProjectEntity' FOREIGN KEY ('ProjectEntityId') REFERENCES 'ProjectEntity' ('ProjectEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'FailureMechanismEntity'
(
	'FailureMechanismEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'AssessmentSectionEntityId' INTEGER NOT NULL,
	'CalculationGroupEntityId' INTEGER,
	'FailureMechanismType' SMALLINT NOT NULL, -- Enum: 1 = Piping, 2 = Macrostabiliteit binnenwaarts, 3= Golfklappen op asfaltbekleding, 4= Grasbekleding erosie buitentalud, 5 = Grasbekleding afschuiven buitentalud, 6 = Grasbekleding erosie kruin en binnentalud, 7 = Stabiliteit steenzetting, 8 = Duinafslag, 9 = Hoogte kunstwerk, 10 = Betrouwbaarheid sluiten kunstwerk, 11 = Piping bij kunstwerk, 12 = Sterkte en stabiliteit puntconstructires, 13 = Macrostabiliteit buitenwaarts, 14 = Microstabiliteit, 15 = Wateroverdruk bij asfaltbekleding, 16 = Grasbekleding afschuiven binnentalud, 17 = Sterkte en stabiliteit langsconstructires, 18 = Technische innovaties
	'IsRelevant' TINYINT (1) NOT NULL, -- true or false
	'InputComments' TEXT,
	'OutputComments' TEXT,
	'NotRelevantComments' TEXT,
	CONSTRAINT 'FK_FailureMechanismEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_FailureMechanismEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'UI_AssessmentSectionEntityId_FailureMechanismType' UNIQUE ('AssessmentSectionEntityId','FailureMechanismType')
)
;

CREATE TABLE 'FailureMechanismSectionEntity'
(
	'FailureMechanismSectionEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'FailureMechanismSectionPointXml' TEXT NOT NULL,
	CONSTRAINT 'FK_FailureMechanismSectionEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'PipingFailureMechanismMetaEntity'
(
	'PipingFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'A' REAL NOT NULL,
	'WaterVolumetricWeight' REAL NOT NULL,
	'StochasticSoilModelSourcePath' TEXT,
	'SurfaceLineSourcePath' TEXT,
	CONSTRAINT 'FK_PipingFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityPointStructuresFailureMechanismMetaEntity'
(
	'StrengthStabilityPointConstructionFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N' INT (4) NOT NULL,
	CONSTRAINT 'FK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'ClosingStructuresFailureMechanismMetaEntity'
(
	'ClosingStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N2A' INT (4) NOT NULL,
	CONSTRAINT 'FK_ClosingStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'DuneErosionFailureMechanismMetaEntity'
(
	'DuneErosionFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N' REAL NOT NULL,
	CONSTRAINT 'FK_DuneErosionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'CalculationGroupEntity'
(
	'CalculationGroupEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'ParentCalculationGroupEntityId' INTEGER,
	'Name' VARCHAR (260),
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_CalculationGroupEntity_CalculationGroupEntity' FOREIGN KEY ('ParentCalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'HeightStructuresFailureMechanismMetaEntity'
(
	'HeightStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N' INT (4) NOT NULL,
	CONSTRAINT 'FK_HeightStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'HydraulicLocationEntity'
(
	'HydraulicLocationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'AssessmentSectionEntityId' INTEGER NOT NULL,
	'LocationId' INTEGER NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'LocationX' REAL,
	'LocationY' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_HydraulicLocationEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'PipingCalculationEntity'
(
	'PipingCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'SurfaceLineEntityId' INTEGER,
	'StochasticSoilProfileEntityId' INTEGER,
	'HydraulicLocationEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'EntryPointL' REAL,
	'ExitPointL' REAL,
	'PhreaticLevelExitMean' REAL,
	'PhreaticLevelExitStandardDeviation' REAL,
	'DampingFactorExitMean' REAL,
	'DampingFactorExitStandardDeviation' REAL,
	'RelevantForScenario' TINYINT (1) NOT NULL, -- true or false
	'ScenarioContribution' REAL,
	'AssessmentLevel' REAL,
	'UseAssessmentLevelManualInput' TINYINT (1) NOT NULL, -- true or false
	CONSTRAINT 'FK_PipingCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_PipingCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_PipingCalculationEntity_StochasticSoilProfileEntity' FOREIGN KEY ('StochasticSoilProfileEntityId') REFERENCES 'StochasticSoilProfileEntity' ('StochasticSoilProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_PipingCalculationEntity_SurfaceLineEntity' FOREIGN KEY ('SurfaceLineEntityId') REFERENCES 'SurfaceLineEntity' ('SurfaceLineEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
(
	'GrassCoverErosionInwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N' INT (4) NOT NULL,
	CONSTRAINT 'FK_GrassCoverErosionInwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionInwardsCalculationEntity'
(
	'GrassCoverErosionInwardsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'HydraulicLocationEntityId' INTEGER,
	'DikeProfileEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'Orientation' REAL,
	'CriticalFlowRateMean' REAL,
	'CriticalFlowRateStandardDeviation' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'DikeHeightCalculationType' TINYINT (1) NOT NULL, -- Enum: 1 = NoCalculation, 2 = CalculateByAssessmentSectionNorm, 3 = CalculateByProfileSpecificRequiredProbability
	'DikeHeight' REAL,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'OvertoppingRateCalculationType' TINYINT (1) NOT NULL, -- Enum: 1 = NoCalculation, 2 = CalculateByAssessmentSectionNorm, 3 = CalculateByProfileSpecificRequiredProbability
	CONSTRAINT 'FK_GrassCoverErosionInwardsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_GrassCoverErosionInwardsCalculationEntity_DikeProfileEntity' FOREIGN KEY ('DikeProfileEntityId') REFERENCES 'DikeProfileEntity' ('DikeProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_GrassCoverErosionInwardsCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
(
	'GrassCoverErosionOutwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'N' INT (4) NOT NULL,
	CONSTRAINT 'FK_GrassCoverErosionOutwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'SoilLayerEntity'
(
	'SoilLayerEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'SoilProfileEntityId' INTEGER NOT NULL,
	'Top' REAL,
	'IsAquifer' TINYINT (1) NOT NULL, -- true or false
	'Color' INTEGER NOT NULL, -- ARGB value of Color.
	'MaterialName' TEXT NOT NULL,
	'BelowPhreaticLevelMean' REAL,
	'BelowPhreaticLevelDeviation' REAL,
	'DiameterD70Mean' REAL,
	'DiameterD70Deviation' REAL,
	'BelowPhreaticLevelShift' REAL,
	'PermeabilityMean' REAL,
	'PermeabilityDeviation' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_SoilLayerEntity_SoilProfileEntity' FOREIGN KEY ('SoilProfileEntityId') REFERENCES 'SoilProfileEntity' ('SoilProfileEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'SoilProfileEntity'
(
	'SoilProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'Bottom' REAL,
	'Name' TEXT
)
;

CREATE TABLE 'StochasticSoilProfileEntity'
(
	'StochasticSoilProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'SoilProfileEntityId' INTEGER NOT NULL,
	'StochasticSoilModelEntityId' INTEGER NOT NULL,
	'Type' TINYINT (1) NOT NULL, -- Enum: 1 = SoilProfile1D, 2 = SoilProfile2D
	'Probability' REAL NOT NULL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_StochasticSoilProfileEntity_SoilProfileEntity' FOREIGN KEY ('SoilProfileEntityId') REFERENCES 'SoilProfileEntity' ('SoilProfileEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_StochasticSoilProfileEntity_StochasticSoilModelEntity' FOREIGN KEY ('StochasticSoilModelEntityId') REFERENCES 'StochasticSoilModelEntity' ('StochasticSoilModelEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StochasticSoilModelEntity'
(
	'StochasticSoilModelEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Name' TEXT NOT NULL,
	'SegmentName' TEXT,
	'StochasticSoilModelSegmentPointXml' TEXT NOT NULL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_StochasticSoilModelEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'UQ_StochasticSoilModelEntity_NameFailureMechanismEntityId' UNIQUE ('Name','FailureMechanismEntityId')
)
;

CREATE TABLE 'SurfaceLineEntity'
(
	'SurfaceLineEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Name' VARCHAR (260),
	'ReferenceLineIntersectionX' REAL,
	'ReferenceLineIntersectionY' REAL,
	'PointsXml' TEXT NOT NULL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_SurfaceLineEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'UQ_SurfaceLineEntity_NameFailureMechanismEntityId' UNIQUE ('Name','FailureMechanismEntityId')
)
;

CREATE TABLE 'CharacteristicPointEntity'
(
	'CharacteristicPointEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'SurfaceLineEntityId' INTEGER NOT NULL,
	'Type' TINYINT (1) NOT NULL, -- Enum: 1 = DikeToeAtRiver, 2 = DikeToeAtPolder, 3 = DitchDikeSide, 4 = BottomDitchDikeSide, 5 = BottomDitchPolderSide, 6 = DitchPolderSide
	'X' REAL,
	'Y' REAL,
	'Z' REAL,
	CONSTRAINT 'FK_SurfaceLinePointEntity_SurfaceLineEntity' FOREIGN KEY ('SurfaceLineEntityId') REFERENCES 'SurfaceLineEntity' ('SurfaceLineEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'PipingCalculationOutputEntity'
(
	'PipingCalculationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'PipingCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'HeaveFactorOfSafety' REAL,
	'HeaveZValue' REAL,
	'UpliftFactorOfSafety' REAL,
	'UpliftZValue' REAL,
	'SellmeijerFactorOfSafety' REAL,
	'SellmeijerZValue' REAL,
	'UpliftEffectiveStress' REAL,
	'HeaveGradient' REAL,
	'SellmeijerCreepCoefficient' REAL,
	'SellmeijerCriticalFall' REAL,
	'SellmeijerReducedFall' REAL,
	CONSTRAINT 'FK_PipingCalculationOutputEntity_PipingCalculationEntity' FOREIGN KEY ('PipingCalculationEntityId') REFERENCES 'PipingCalculationEntity' ('PipingCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_PipingCalculationEntity' UNIQUE ('PipingCalculationEntityId')
)
;

CREATE TABLE 'PipingSemiProbabilisticOutputEntity'
(
	'PipingSemiProbabilisticOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'PipingCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'UpliftFactorOfSafety' REAL,
	'UpliftReliability' REAL,
	'UpliftProbability' REAL,
	'HeaveFactorOfSafety' REAL,
	'HeaveReliability' REAL,
	'HeaveProbability' REAL,
	'SellmeijerFactorOfSafety' REAL,
	'SellmeijerReliability' REAL,
	'SellmeijerProbability' REAL,
	'RequiredProbability' REAL,
	'RequiredReliability' REAL,
	'PipingProbability' REAL,
	'PipingReliability' REAL,
	'PipingFactorOfSafety' REAL,
	CONSTRAINT 'FK_PipingSemiProbabilisticOutputEntity_PipingCalculationEntity' FOREIGN KEY ('PipingCalculationEntityId') REFERENCES 'PipingCalculationEntity' ('PipingCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_PipingCalculationEntity' UNIQUE ('PipingCalculationEntityId')
)
;

CREATE TABLE 'PipingSectionResultEntity'
(
	'PipingSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_PipingSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionInwardsSectionResultEntity'
(
	'GrassCoverErosionInwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'GrassCoverErosionInwardsCalculationEntityId' INTEGER,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_GrassCoverErosionInwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_GrassCoverErosionInwardsSectionResultEntity_GrassCoverErosionInwardsCalculationEntity' FOREIGN KEY ('GrassCoverErosionInwardsCalculationEntityId') REFERENCES 'GrassCoverErosionInwardsCalculationEntity' ('GrassCoverErosionInwardsCalculationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'HeightStructuresSectionResultEntity'
(
	'HeightStructuresSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'HeightStructuresCalculationEntityId' INTEGER,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_HeightStructuresSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_HeightStructuresSectionResultEntity_HeightStructuresCalculationEntity' FOREIGN KEY ('HeightStructuresCalculationEntityId') REFERENCES 'HeightStructuresCalculationEntity' ('HeightStructuresCalculationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'StrengthStabilityLengthwiseConstructionSectionResultEntity'
(
	'StrengthStabilityLengthwiseConstructionSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_StrengthStabilityLengthwiseConstructionSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'TechnicalInnovationSectionResultEntity'
(
	'TechnicalInnovationSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_TechnicalInnovationSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'WaterPressureAsphaltCoverSectionResultEntity'
(
	'WaterPressureAsphaltCoverSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_WaterPressureAsphaltCoverSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'ClosingStructuresSectionResultEntity'
(
	'ClosingStructuresSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'ClosingStructuresCalculationEntityId' INTEGER,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_ClosingStructuresSectionResultEntity_ClosingStructuresCalculationEntity' FOREIGN KEY ('ClosingStructuresCalculationEntityId') REFERENCES 'ClosingStructuresCalculationEntity' ('ClosingStructuresCalculationEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_ClosingStructuresSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionOutwardsSectionResultEntity'
(
	'GrassCoverErosionOutwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_GrassCoverErosionOutwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverSlipOffInwardsSectionResultEntity'
(
	'GrassCoverSlipOffInwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_GrassCoverSlipOffInwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverSlipOffOutwardsSectionResultEntity'
(
	'GrassCoverSlipOffOutwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_GrassCoverSlipOffOutwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'MacrostabilityInwardsSectionResultEntity'
(
	'MacrostabilityInwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' REAL,
	'LayerThree' REAL,
	CONSTRAINT 'FK_MacrostabilityInwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'MacrostabilityOutwardsSectionResultEntity'
(
	'MacrostabilityOutwardsSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' REAL,
	'LayerThree' REAL,
	CONSTRAINT 'FK_MacrostabilityOutwardsSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'WaveImpactAsphaltCoverSectionResultEntity'
(
	'WaveImpactAsphaltCoverSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_WaveImpactAsphaltCoverSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'MicrostabilitySectionResultEntity'
(
	'MicrostabilitySectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_MicrostabilitySectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'PipingStructureSectionResultEntity'
(
	'PipingStructureSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_PipingStructureSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'DuneErosionSectionResultEntity'
(
	'DuneErosionSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_DuneErosionSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityStoneCoverSectionResultEntity'
(
	'StabilityStoneCoverSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerTwoA' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = Failed, 3 = Successful
	'LayerThree' REAL,
	CONSTRAINT 'FK_StabilityStoneCoverSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityPointStructuresSectionResultEntity'
(
	'StabilityPointStructuresSectionResultEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismSectionEntityId' INTEGER NOT NULL,
	'StabilityPointStructuresCalculationEntityId' INTEGER,
	'LayerOne' TINYINT (1) NOT NULL, -- Enum: 1 = NotAssessed, 2 = Sufficient, 3 = NoVerdict
	'LayerThree' REAL,
	CONSTRAINT 'FK_StabilityPointStructuresSectionResultEntity_FailureMechanismSectionEntity' FOREIGN KEY ('FailureMechanismSectionEntityId') REFERENCES 'FailureMechanismSectionEntity' ('FailureMechanismSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityPointStructuresSectionResultEntity_StabilityPointStructuresCalculationEntity' FOREIGN KEY ('StabilityPointStructuresCalculationEntityId') REFERENCES 'StabilityPointStructuresCalculationEntity' ('StabilityPointStructuresCalculationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'DikeProfileEntity'
(
	'DikeProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Id' VARCHAR (260) NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'Orientation' REAL,
	'BreakWaterType' TINYINT (1), -- Enum: 1 = Wall 2 = Caisson 3 = Dam
	'BreakWaterHeight' REAL,
	'ForeshoreXml' TEXT NOT NULL,
	'DikeGeometryXml' TEXT NOT NULL,
	'DikeHeight' REAL,
	'X' REAL,
	'Y' REAL,
	'X0' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_DikeProfileEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionInwardsOutputEntity'
(
	'GrassCoverErosionInwardsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'GrassCoverErosionInwardsCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'IsOvertoppingDominant' TINYINT (1) NOT NULL, -- true or false
	'WaveHeight' REAL,
	'RequiredProbability' REAL,
	'RequiredReliability' REAL,
	'Probability' REAL,
	'Reliability' REAL,
	'FactorOfSafety' REAL,
	CONSTRAINT 'FK_GrassCoverErosionInwardsOutputEntity_GrassCoverErosionInwardsCalculationEntity' FOREIGN KEY ('GrassCoverErosionInwardsCalculationEntityId') REFERENCES 'GrassCoverErosionInwardsCalculationEntity' ('GrassCoverErosionInwardsCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_GrassCoverErosionInwardsCalculationEntity' UNIQUE ('GrassCoverErosionInwardsCalculationEntityId')
)
;

CREATE TABLE 'ForeshoreProfileEntity'
(
	'ForeshoreProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Id' VARCHAR (260) NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'Orientation' REAL,
	'BreakWaterType' TINYINT (1), -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'GeometryXml' TEXT NOT NULL,
	'X' REAL,
	'Y' REAL,
	'X0' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_ForeshoreProfileEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityStoneCoverWaveConditionsCalculationEntity'
(
	'StabilityStoneCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'ForeshoreProfileEntityId' INTEGER,
	'HydraulicLocationEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'Orientation' REAL,
	'UpperBoundaryRevetment' REAL,
	'LowerBoundaryRevetment' REAL,
	'UpperBoundaryWaterLevels' REAL,
	'LowerBoundaryWaterLevels' REAL,
	'StepSize' TINYINT (1) NOT NULL, -- Enum: 1 = 0.5, 2 = 1.0, 3 = 2.0
	CONSTRAINT 'FK_StabilityStoneCoverWaveConditionsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityStoneCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_StabilityStoneCoverWaveConditionsCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityStoneCoverWaveConditionsOutputEntity'
(
	'StabilityStoneCoverWaveConditionsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'StabilityStoneCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'OutputType' TINYINT (1) NOT NULL, -- Enum: 1 = Column, 2 = Block
	'WaterLevel' REAL,
	'WaveHeight' REAL,
	'WavePeakPeriod' REAL,
	'WaveAngle' REAL,
	'WaveDirection' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
	CONSTRAINT 'FK_StabilityStoneCoverWaveConditionsOutputEntity_StabilityStoneCoverWaveConditionsCalculationEntity' FOREIGN KEY ('StabilityStoneCoverWaveConditionsCalculationEntityId') REFERENCES 'StabilityStoneCoverWaveConditionsCalculationEntity' ('StabilityStoneCoverWaveConditionsCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity'
(
	'WaveImpactAsphaltCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'ForeshoreProfileEntityId' INTEGER,
	'HydraulicLocationEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'Orientation' REAL,
	'UpperBoundaryRevetment' REAL,
	'LowerBoundaryRevetment' REAL,
	'UpperBoundaryWaterLevels' REAL,
	'LowerBoundaryWaterLevels' REAL,
	'StepSize' TINYINT (1) NOT NULL, -- Enum: 1 = 0.5, 2 = 1.0, 3 = 2.0
	CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'WaveImpactAsphaltCoverWaveConditionsOutputEntity'
(
	'WaveImpactAsphaltCoverWaveConditionsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'WaveImpactAsphaltCoverWaveConditionsCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'WaterLevel' REAL,
	'WaveHeight' REAL,
	'WavePeakPeriod' REAL,
	'WaveAngle' REAL,
	'WaveDirection' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
	CONSTRAINT 'FK_WaveImpactAsphaltCoverWaveConditionsOutputEntity_WaveImpactAsphaltCoverWaveConditionsCalculationEntity' FOREIGN KEY ('WaveImpactAsphaltCoverWaveConditionsCalculationEntityId') REFERENCES 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('WaveImpactAsphaltCoverWaveConditionsCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
(
	'GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'ForeshoreProfileEntityId' INTEGER,
	'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'Orientation' REAL,
	'UpperBoundaryRevetment' REAL,
	'LowerBoundaryRevetment' REAL,
	'UpperBoundaryWaterLevels' REAL,
	'LowerBoundaryWaterLevels' REAL,
	'StepSize' TINYINT (1) NOT NULL, -- Enum: 1 = 0.5, 2 = 1.0, 3 = 2.0
	CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsHydraulicLocationEntityId') REFERENCES 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionOutwardsHydraulicLocationEntity'
(
	'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'LocationId' INTEGER NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'LocationX' REAL,
	'LocationY' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'GrassCoverErosionOutwardsWaveConditionsOutputEntity'
(
	'GrassCoverErosionOutwardsWaveConditionsOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'WaterLevel' REAL,
	'WaveHeight' REAL,
	'WavePeakPeriod' REAL,
	'WaveAngle' REAL,
	'WaveDirection' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
	CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsOutputEntity_GrassCoverErosionOutwardsWaveConditionsCalculationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsWaveConditionsCalculationEntityId') REFERENCES 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('GrassCoverErosionOutwardsWaveConditionsCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'HeightStructuresOutputEntity'
(
	'HeightStructuresOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'HeightStructuresCalculationEntityId' INTEGER NOT NULL,
	'RequiredProbability' REAL,
	'RequiredReliability' REAL,
	'Probability' REAL,
	'Reliability' REAL,
	'FactorOfSafety' REAL,
	CONSTRAINT 'FK_HeightStructuresOutputEntity_HeightStructuresCalculationEntity' FOREIGN KEY ('HeightStructuresCalculationEntityId') REFERENCES 'HeightStructuresCalculationEntity' ('HeightStructuresCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_HeightStructuresCalculationEntity' UNIQUE ('HeightStructuresCalculationEntityId')
)
;

CREATE TABLE 'HeightStructureEntity'
(
	'HeightStructureEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Id' VARCHAR (260),
	'X' REAL,
	'Y' REAL,
	'StructureNormalOrientation' REAL,
	'LevelCrestStructureMean' REAL,
	'LevelCrestStructureStandardDeviation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'FailureProbabilityStructureWithErosion' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	CONSTRAINT 'FK_HeightStructure_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'HeightStructuresCalculationEntity'
(
	'HeightStructuresCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'HydraulicLocationEntityId' INTEGER,
	'HeightStructureEntityId' INTEGER,
	'ForeshoreProfileEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Comments' TEXT,
	'ModelFactorSuperCriticalFlowMean' REAL,
	'StructureNormalOrientation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'FailureProbabilityStructureWithErosion' REAL NOT NULL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'StormDurationMean' REAL,
	'LevelCrestStructureMean' REAL,
	'LevelCrestStructureStandardDeviation' REAL,
	'DeviationWaveDirection' REAL,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	CONSTRAINT 'FK_HeightStructuresCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_HeightStructuresCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_HeightStructuresCalculationEntity_HeightStructureEntity' FOREIGN KEY ('HeightStructureEntityId') REFERENCES 'HeightStructureEntity' ('HeightStructureEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_HeightStructuresCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'ClosingStructureEntity'
(
	'ClosingStructureEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Id' VARCHAR (260),
	'X' REAL,
	'Y' REAL,
	'StructureNormalOrientation' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'LevelCrestStructureNotClosingMean' REAL,
	'LevelCrestStructureNotClosingStandardDeviation' REAL,
	'InsideWaterLevelMean' REAL,
	'InsideWaterLevelStandardDeviation' REAL,
	'ThresholdHeightOpenWeirMean' REAL,
	'ThresholdHeightOpenWeirStandardDeviation' REAL,
	'AreaFlowAperturesMean' REAL,
	'AreaFlowAperturesStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'ProbabilityOrFrequencyOpenStructureBeforeFlooding' REAL,
	'FailureProbabilityOpenStructure' REAL,
	'IdenticalApertures' INT (4) NOT NULL,
	'FailureProbabilityReparation' REAL,
	'InflowModelType' TINYINT (1) NOT NULL, -- Enum: 1 = VerticalWall, 2 = LowSill, 3 = FloodedCulvert
	CONSTRAINT 'FK_ClosingStructureEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'ClosingStructuresCalculationEntity'
(
	'ClosingStructuresCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'CalculationGroupEntityId' INTEGER NOT NULL,
	'ForeshoreProfileEntityId' INTEGER,
	'HydraulicLocationEntityId' INTEGER,
	'ClosingStructureEntityId' INTEGER,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (255),
	'Comments' TEXT,
	'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
	'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
	'BreakWaterHeight' REAL,
	'UseForeshore' TINYINT (1) NOT NULL, -- true or false
	'Orientation' REAL,
	'StructureNormalOrientation' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'LevelCrestStructureNotClosingMean' REAL,
	'LevelCrestStructureNotClosingStandardDeviation' REAL,
	'InsideWaterLevelMean' REAL,
	'InsideWaterLevelStandardDeviation' REAL,
	'ThresholdHeightOpenWeirMean' REAL,
	'ThresholdHeightOpenWeirStandardDeviation' REAL,
	'AreaFlowAperturesMean' REAL,
	'AreaFlowAperturesStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'ProbabilityOrFrequencyOpenStructureBeforeFlooding' REAL NOT NULL,
	'FailureProbabilityOpenStructure' REAL NOT NULL,
	'IdenticalApertures' INT (4) NOT NULL,
	'FailureProbabilityReparation' REAL NOT NULL,
	'InflowModelType' TINYINT (1) NOT NULL, -- Enum: 1 = VerticalWall, 2 = LowSill, 3 = FloodedCulvert
	'FailureProbabilityStructureWithErosion' REAL NOT NULL,
	'DeviationWaveDirection' REAL,
	'DrainCoefficientMean' REAL,
	'ModelFactorSuperCriticalFlowMean' REAL,
	'StormDurationMean' REAL,
	'FactorStormDurationOpenStructure' REAL,
	CONSTRAINT 'FK_ClosingStructuresCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'FK_ClosingStructuresCalculationEntity_ClosingStructureEntity' FOREIGN KEY ('ClosingStructureEntityId') REFERENCES 'ClosingStructureEntity' ('ClosingStructureEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_ClosingStructuresCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
	CONSTRAINT 'FK_ClosingStructuresCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade
)
;

CREATE TABLE 'ClosingStructuresOutputEntity'
(
	'ClosingStructuresOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'ClosingStructuresCalculationEntityId' INTEGER NOT NULL,
	'RequiredProbability' REAL,
	'RequiredReliability' REAL,
	'Probability' REAL,
	'Reliability' REAL,
	'FactorOfSafety' REAL,
	CONSTRAINT 'FK_ClosingStructuresOutputEntity_ClosingStructuresCalculationEntity' FOREIGN KEY ('ClosingStructuresCalculationEntityId') REFERENCES 'ClosingStructuresCalculationEntity' ('ClosingStructuresCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_ClosingStructuresCalculationEntity' UNIQUE ('ClosingStructuresCalculationEntityId')
)
;

CREATE TABLE 'StabilityPointStructureEntity'
(
	'StabilityPointStructureEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'Order' INT (4) NOT NULL,
	'Name' VARCHAR (260),
	'Id' VARCHAR (260),
	'X' REAL,
	'Y' REAL,
	'StructureNormalOrientation' REAL,
	'StorageStructureAreaMean' REAL,
	'StorageStructureAreaCoefficientOfVariation' REAL,
	'AllowedLevelIncreaseStorageMean' REAL,
	'AllowedLevelIncreaseStorageStandardDeviation' REAL,
	'WidthFlowAperturesMean' REAL,
	'WidthFlowAperturesStandardDeviation' REAL,
	'InsideWaterLevelMean' REAL,
	'InsideWaterLevelStandardDeviation' REAL,
	'ThresholdHeightOpenWeirMean' REAL,
	'ThresholdHeightOpenWeirStandardDeviation' REAL,
	'CriticalOvertoppingDischargeMean' REAL,
	'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
	'FlowWidthAtBottomProtectionMean' REAL,
	'FlowWidthAtBottomProtectionStandardDeviation' REAL,
	'ConstructiveStrengthLinearLoadModelMean' REAL,
	'ConstructiveStrengthLinearLoadModelCoefficientOfVariation' REAL,
	'ConstructiveStrengthQuadraticLoadModelMean' REAL,
	'ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation' REAL,
	'BankWidthMean' REAL,
	'BankWidthStandardDeviation' REAL,
	'InsideWaterLevelFailureConstructionMean' REAL,
	'InsideWaterLevelFailureConstructionStandardDeviation' REAL,
	'EvaluationLevel' REAL,
	'LevelCrestStructureMean' REAL,
	'LevelCrestStructureStandardDeviation' REAL,
	'VerticalDistance' REAL,
	'FailureProbabilityRepairClosure' REAL,
	'FailureCollisionEnergyMean' REAL,
	'FailureCollisionEnergyCoefficientOfVariation' REAL,
	'ShipMassMean' REAL,
	'ShipMassCoefficientOfVariation' REAL,
	'ShipVelocityMean' REAL,
	'ShipVelocityCoefficientOfVariation' REAL,
	'LevellingCount' INT (4) NOT NULL,
	'ProbabilityCollisionSecondaryStructure' REAL,
	'FlowVelocityStructureClosableMean' REAL,
	'StabilityLinearLoadModelMean' REAL,
	'StabilityLinearLoadModelCoefficientOfVariation' REAL,
	'StabilityQuadraticLoadModelMean' REAL,
	'StabilityQuadraticLoadModelCoefficientOfVariation' REAL,
	'AreaFlowAperturesMean' REAL,
	'AreaFlowAperturesStandardDeviation' REAL,
	'InflowModelType' TINYINT (1) NOT NULL, -- Enum: 1 = LowSill, 2 = FloodedCulvert
	CONSTRAINT 'FK_StabilityPointStructureEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'StabilityPointStructuresOutputEntity'
(
	'StabilityPointStructuresOutputEntity' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'StabilityPointStructuresCalculationEntityId' INTEGER NOT NULL,
	'RequiredProbability' REAL,
	'RequiredReliability' REAL,
	'Probability' REAL,
	'Reliability' REAL,
	'FactorOfSafety' REAL,
	CONSTRAINT 'FK_StabilityPointStructuresOutputEntity_StabilityPointStructuresCalculationEntity' FOREIGN KEY ('StabilityPointStructuresCalculationEntityId') REFERENCES 'StabilityPointStructuresCalculationEntity' ('StabilityPointStructuresCalculationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_StabilityPointStructuresCalculationEntity' UNIQUE ('StabilityPointStructuresCalculationEntityId')
)
;

CREATE TABLE 'HydraulicLocationOutputEntity'
(
	'HydraulicLocationEntityOutputId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'HydraulicLocationEntityId' INTEGER NOT NULL,
	'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight
	'Result' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged
	CONSTRAINT 'FK_HydraulicLocationOutputEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_HydraulicLocationEntityOutputType' UNIQUE ('HydraulicLocationEntityId','HydraulicLocationOutputType')
)
;

CREATE TABLE 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity'
(
	'GrassCoverErosionOutwardsHydraulicLocationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL,
	'HydraulicLocationOutputType' TINYINT (1) NOT NULL, -- Enum: 1 = DesignWaterLevel, 2 = WaveHeight
	'Result' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged
	CONSTRAINT 'FK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity' FOREIGN KEY ('GrassCoverErosionOutwardsHydraulicLocationEntityId') REFERENCES 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_HydraulicLocationOutputType' UNIQUE ('GrassCoverErosionOutwardsHydraulicLocationEntityId','HydraulicLocationOutputType')
)
;

CREATE TABLE 'DuneLocationEntity'
(
	'DuneLocationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'FailureMechanismEntityId' INTEGER NOT NULL,
	'LocationId' INTEGER NOT NULL,
	'Name' VARCHAR (260) NOT NULL,
	'LocationX' REAL,
	'LocationY' REAL,
	'CoastalAreaId' INT (4) NOT NULL,
	'Offset' REAL,
	'Orientation' REAL,
	'D50' REAL,
	'Order' INT (4) NOT NULL,
	CONSTRAINT 'FK_DuneLocationEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'DuneLocationOutputEntity'
(
	'DuneLocationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'DuneLocationEntityId' INTEGER NOT NULL,
	'WaterLevel' REAL,
	'WaveHeight' REAL,
	'WavePeriod' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculatedNotConverged, 3 = CalculatedConverged
	CONSTRAINT 'FK_DuneLocationOutputEntity_DuneLocationEntity' FOREIGN KEY ('DuneLocationEntityId') REFERENCES 'DuneLocationEntity' ('DuneLocationEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'BackgroundDataEntity'
(
	'BackgroundDataEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'AssessmentSectionEntityId' INTEGER NOT NULL,
	'Name' TEXT NOT NULL,
	'IsVisible' TINYINT (1) NOT NULL, -- true or false
	'Transparency' REAL NOT NULL,
	'BackgroundDataType' TINYINT (1) NOT NULL, -- Enum: 1 = Wmts, 2 = WellKnown
	CONSTRAINT 'FK_BackgroundDataEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
)
;

CREATE TABLE 'BackgroundDataMetaEntity'
(
	'BackgroundDataMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'BackgroundDataEntityId' INTEGER NOT NULL,
	'Key' TEXT NOT NULL,
	'Value' TEXT NOT NULL,
	CONSTRAINT 'FK_BackgroundDataMetaEntity_BackgroundDataEntity' FOREIGN KEY ('BackgroundDataEntityId') REFERENCES 'BackgroundDataEntity' ('BackgroundDataEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_BackgroundDataEntityId_Key' UNIQUE ('BackgroundDataEntityId','Key')
)
;

CREATE TABLE 'GrassCoverErosionInwardsOvertoppingRateOutputEntity'
(
	'GrassCoverErosionInwardsOvertoppingRateOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	'GrassCoverErosionInwardsOutputEntityId' INTEGER NOT NULL,
	'OvertoppingRate' REAL,
	'TargetProbability' REAL,
	'TargetReliability' REAL,
	'CalculatedProbability' REAL,
	'CalculatedReliability' REAL,
	'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
	CONSTRAINT 'FK_GrassCoverErosionInwardsOvertoppingRateOutputEntity_GrassCoverErosionInwardsOutputEntity' FOREIGN KEY ('GrassCoverErosionInwardsOutputEntityId') REFERENCES 'GrassCoverErosionInwardsOutputEntity' ('GrassCoverErosionInwardsOutputEntityId') ON DELETE Cascade ON UPDATE Cascade,
	CONSTRAINT 'U_GrassCoverErosionInwardsOutputEntity' UNIQUE ('GrassCoverErosionInwardsOutputEntityId')
)
;

/* Create Indexes and Triggers */

CREATE INDEX 'IXFK_GrassCoverErosionInwardsDikeHeightOutputEntity_GrassCoverErosionInwardsOutputEntity'
 ON 'GrassCoverErosionInwardsDikeHeightOutputEntity' ('GrassCoverErosionInwardsOutputEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresCalculationEntity_CalculationGroupEntity'
 ON 'StabilityPointStructuresCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresCalculationEntity_ForeshoreProfileEntity'
 ON 'StabilityPointStructuresCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresCalculationEntity_HydraulicLocationEntity'
 ON 'StabilityPointStructuresCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresCalculationEntity_StabilityPointStructureEntity'
 ON 'StabilityPointStructuresCalculationEntity' ('StabilityPointStructureEntityId' ASC)
;

CREATE INDEX 'IXFK_AssessmentSectionEntity_ProjectEntity'
 ON 'AssessmentSectionEntity' ('ProjectEntityId' ASC)
;

CREATE INDEX 'IXFK_FailureMechanismEntity_AssessmentSectionEntity'
 ON 'FailureMechanismEntity' ('AssessmentSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_FailureMechanismEntity_CalculationGroupEntity'
 ON 'FailureMechanismEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_FailureMechanismSectionEntity_FailureMechanismEntity'
 ON 'FailureMechanismSectionEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'PipingFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'StabilityPointStructuresFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'ClosingStructuresFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_DuneErosionFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'DuneErosionFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_CalculationGroupEntity_CalculationGroupEntity'
 ON 'CalculationGroupEntity' ('ParentCalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'HeightStructuresFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_HydraulicLocationEntity_AssessmentSectionEntity'
 ON 'HydraulicLocationEntity' ('AssessmentSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingCalculationEntity_StochasticSoilProfileEntity'
 ON 'PipingCalculationEntity' ('StochasticSoilProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingCalculationEntity_SurfaceLineEntity'
 ON 'PipingCalculationEntity' ('SurfaceLineEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingCalculationEntity_HydraulicLocationEntity'
 ON 'PipingCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingCalculationEntity_CalculationGroupEntity'
 ON 'PipingCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'GrassCoverErosionInwardsFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsCalculationEntity_CalculationGroupEntity'
 ON 'GrassCoverErosionInwardsCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsCalculationEntity_DikeProfileEntity'
 ON 'GrassCoverErosionInwardsCalculationEntity' ('DikeProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsCalculationEntity_HydraulicLocationEntity'
 ON 'GrassCoverErosionInwardsCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsFailureMechanismMetaEntity_FailureMechanismEntity'
 ON 'GrassCoverErosionOutwardsFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_StochasticSoilProfileEntity_SoilProfileEntity'
 ON 'StochasticSoilProfileEntity' ('SoilProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_StochasticSoilProfileEntity_StochasticSoilModelEntity'
 ON 'StochasticSoilProfileEntity' ('StochasticSoilModelEntityId' ASC)
;

CREATE INDEX 'IXFK_StochasticSoilModelEntity_FailureMechanismEntity'
 ON 'StochasticSoilModelEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_SurfaceLineEntity_FailureMechanismEntity'
 ON 'SurfaceLineEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_SurfaceLinePointEntity_SurfaceLineEntity'
 ON 'CharacteristicPointEntity' ('SurfaceLineEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingCalculationOutputEntity_PipingCalculationEntity'
 ON 'PipingCalculationOutputEntity' ('PipingCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingSemiProbabilisticOutputEntity_PipingCalculationEntity'
 ON 'PipingSemiProbabilisticOutputEntity' ('PipingCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingSectionResultEntity_FailureMechanismSectionEntity'
 ON 'PipingSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'GrassCoverErosionInwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsSectionResultEntity_GrassCoverErosionInwardsCalculationEntity'
 ON 'GrassCoverErosionInwardsSectionResultEntity' ('GrassCoverErosionInwardsCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresSectionResultEntity_FailureMechanismSectionEntity'
 ON 'HeightStructuresSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresSectionResultEntity_HeightStructuresCalculationEntity'
 ON 'HeightStructuresSectionResultEntity' ('HeightStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_StrengthStabilityLengthwiseConstructionSectionResultEntity_FailureMechanismSectionEntity'
 ON 'StrengthStabilityLengthwiseConstructionSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_TechnicalInnovationSectionResultEntity_FailureMechanismSectionEntity'
 ON 'TechnicalInnovationSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_WaterPressureAsphaltCoverSectionResultEntity_FailureMechanismSectionEntity'
 ON 'WaterPressureAsphaltCoverSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresSectionResultEntity_ClosingStructuresCalculationEntity'
 ON 'ClosingStructuresSectionResultEntity' ('ClosingStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresSectionResultEntity_FailureMechanismSectionEntity'
 ON 'ClosingStructuresSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'GrassCoverErosionOutwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverSlipOffInwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'GrassCoverSlipOffInwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverSlipOffOutwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'GrassCoverSlipOffOutwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_MacrostabilityInwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'MacrostabilityInwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_MacrostabilityOutwardsSectionResultEntity_FailureMechanismSectionEntity'
 ON 'MacrostabilityOutwardsSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_WaveImpactAsphaltCoverSectionResultEntity_FailureMechanismSectionEntity'
 ON 'WaveImpactAsphaltCoverSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_MicrostabilitySectionResultEntity_FailureMechanismSectionEntity'
 ON 'MicrostabilitySectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_PipingStructureSectionResultEntity_FailureMechanismSectionEntity'
 ON 'PipingStructureSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_DuneErosionSectionResultEntity_FailureMechanismSectionEntity'
 ON 'DuneErosionSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityStoneCoverSectionResultEntity_FailureMechanismSectionEntity'
 ON 'StabilityStoneCoverSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresSectionResultEntity_FailureMechanismSectionEntity'
 ON 'StabilityPointStructuresSectionResultEntity' ('FailureMechanismSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresSectionResultEntity_StabilityPointStructuresCalculationEntity'
 ON 'StabilityPointStructuresSectionResultEntity' ('StabilityPointStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_DikeProfileEntity_FailureMechanismEntity'
 ON 'DikeProfileEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsOutputEntity_GrassCoverErosionInwardsCalculationEntity'
 ON 'GrassCoverErosionInwardsOutputEntity' ('GrassCoverErosionInwardsCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_ForeshoreProfileEntity_FailureMechanismEntity'
 ON 'ForeshoreProfileEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityStoneCoverWaveConditionsCalculationEntity_CalculationGroupEntity'
 ON 'StabilityStoneCoverWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityStoneCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity'
 ON 'StabilityStoneCoverWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityStoneCoverWaveConditionsCalculationEntity_HydraulicLocationEntity'
 ON 'StabilityStoneCoverWaveConditionsCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityStoneCoverWaveConditionsOutputEntity_StabilityStoneCoverWaveConditionsCalculationEntity'
 ON 'StabilityStoneCoverWaveConditionsOutputEntity' ('StabilityStoneCoverWaveConditionsCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_CalculationGroupEntity'
 ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_ForeshoreProfileEntity'
 ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsCalculationEntity_HydraulicLocationEntity'
 ON 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_WaveImpactAsphaltCoverWaveConditionsOutputEntity_WaveImpactAsphaltCoverWaveConditionsCalculationEntity'
 ON 'WaveImpactAsphaltCoverWaveConditionsOutputEntity' ('WaveImpactAsphaltCoverWaveConditionsCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_CalculationGroupEntity'
 ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_ForeshoreProfileEntity'
 ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_GrassCoverErosionOutwardsHydraulicLocationEntity'
 ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationEntity_FailureMechanismEntity'
 ON 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsOutputEntity_GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
 ON 'GrassCoverErosionOutwardsWaveConditionsOutputEntity' ('GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresOutputEntity_HeightStructuresCalculationEntity'
 ON 'HeightStructuresOutputEntity' ('HeightStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructure_FailureMechanismEntity'
 ON 'HeightStructureEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresCalculationEntity_CalculationGroupEntity'
 ON 'HeightStructuresCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresCalculationEntity_ForeshoreProfileEntity'
 ON 'HeightStructuresCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresCalculationEntity_HeightStructureEntity'
 ON 'HeightStructuresCalculationEntity' ('HeightStructureEntityId' ASC)
;

CREATE INDEX 'IXFK_HeightStructuresCalculationEntity_HydraulicLocationEntity'
 ON 'HeightStructuresCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructureEntity_FailureMechanismEntity'
 ON 'ClosingStructureEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresCalculationEntity_CalculationGroupEntity'
 ON 'ClosingStructuresCalculationEntity' ('CalculationGroupEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresCalculationEntity_ClosingStructureEntity'
 ON 'ClosingStructuresCalculationEntity' ('ClosingStructureEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresCalculationEntity_ForeshoreProfileEntity'
 ON 'ClosingStructuresCalculationEntity' ('ForeshoreProfileEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresCalculationEntity_HydraulicLocationEntity'
 ON 'ClosingStructuresCalculationEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_ClosingStructuresOutputEntity_ClosingStructuresCalculationEntity'
 ON 'ClosingStructuresOutputEntity' ('ClosingStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructureEntity_FailureMechanismEntity'
 ON 'StabilityPointStructureEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_StabilityPointStructuresOutputEntity_StabilityPointStructuresCalculationEntity'
 ON 'StabilityPointStructuresOutputEntity' ('StabilityPointStructuresCalculationEntityId' ASC)
;

CREATE INDEX 'IXFK_HydraulicLocationOutputEntity_HydraulicLocationEntity'
 ON 'HydraulicLocationOutputEntity' ('HydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity'
 ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_DuneLocationEntity_FailureMechanismEntity'
 ON 'DuneLocationEntity' ('FailureMechanismEntityId' ASC)
;

CREATE INDEX 'IXFK_DuneLocationOutputEntity_DuneLocationEntity'
 ON 'DuneLocationOutputEntity' ('DuneLocationEntityId' ASC)
;

CREATE INDEX 'IXFK_BackgroundDataEntity_AssessmentSectionEntity'
 ON 'BackgroundDataEntity' ('AssessmentSectionEntityId' ASC)
;

CREATE INDEX 'IXFK_BackgroundDataMetaEntity_BackgroundDataEntity'
 ON 'BackgroundDataMetaEntity' ('BackgroundDataEntityId' ASC)
;

CREATE INDEX 'IXFK_GrassCoverErosionInwardsOvertoppingRateOutputEntity_GrassCoverErosionInwardsOutputEntity'
 ON 'GrassCoverErosionInwardsOvertoppingRateOutputEntity' ('GrassCoverErosionInwardsOutputEntityId' ASC)
;
