Index: build/DatabaseStructure.sql
===================================================================
diff -u -rcc406f5aa04e824a7b39692695165c5923155758 -rf2de3d7dc89f96fd652a166c5b75c41e22485f21
--- build/DatabaseStructure.sql	(.../DatabaseStructure.sql)	(revision cc406f5aa04e824a7b39692695165c5923155758)
+++ build/DatabaseStructure.sql	(.../DatabaseStructure.sql)	(revision f2de3d7dc89f96fd652a166c5b75c41e22485f21)
@@ -1,6 +1,6 @@
 /* ---------------------------------------------------- */
 /*  Generated by Enterprise Architect Version 12.0 		*/
-/*  Created On : 29-Mar-2018 11:05:25 				*/
+/*  Created On : 30-Mar-2018 08:11:27 				*/
 /*  DBMS       : SQLite 								*/
 /* ---------------------------------------------------- */
 
@@ -21,10 +21,10 @@
 DROP TABLE IF EXISTS 'AssessmentSectionEntity'
 ;
 
-DROP TABLE IF EXISTS 'FailureMechanismSectionEntity'
+DROP TABLE IF EXISTS 'MacroStabilityOutwardsFailureMechanismMetaEntity'
 ;
 
-DROP TABLE IF EXISTS 'MacroStabilityOutwardsFailureMechanismMetaEntity'
+DROP TABLE IF EXISTS 'FailureMechanismSectionEntity'
 ;
 
 DROP TABLE IF EXISTS 'FailureMechanismEntity'
@@ -51,27 +51,27 @@
 DROP TABLE IF EXISTS 'PipingCalculationEntity'
 ;
 
-DROP TABLE IF EXISTS 'StabilityPointStructuresFailureMechanismMetaEntity'
-;
-
 DROP TABLE IF EXISTS 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
 ;
 
-DROP TABLE IF EXISTS 'DuneErosionFailureMechanismMetaEntity'
+DROP TABLE IF EXISTS 'StabilityPointStructuresFailureMechanismMetaEntity'
 ;
 
 DROP TABLE IF EXISTS 'GrassCoverErosionInwardsCalculationEntity'
 ;
 
-DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
+DROP TABLE IF EXISTS 'DuneErosionFailureMechanismMetaEntity'
 ;
 
-DROP TABLE IF EXISTS 'HeightStructuresFailureMechanismMetaEntity'
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
 ;
 
 DROP TABLE IF EXISTS 'PipingSoilLayerEntity'
 ;
 
+DROP TABLE IF EXISTS 'HeightStructuresFailureMechanismMetaEntity'
+;
+
 DROP TABLE IF EXISTS 'PipingSoilProfileEntity'
 ;
 
@@ -174,9 +174,6 @@
 DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
 ;
 
-DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationEntity'
-;
-
 DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsOutputEntity'
 ;
 
@@ -207,9 +204,6 @@
 DROP TABLE IF EXISTS 'HydraulicLocationOutputEntity'
 ;
 
-DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity'
-;
-
 DROP TABLE IF EXISTS 'DuneLocationEntity'
 ;
 
@@ -395,6 +389,15 @@
 )
 ;
 
+CREATE TABLE 'MacroStabilityOutwardsFailureMechanismMetaEntity'
+(
+	'MacroStabilityOutwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+	'FailureMechanismEntityId' INTEGER NOT NULL,
+	'A' REAL NOT NULL,
+	CONSTRAINT 'FK_MacroStabilityOutwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
 CREATE TABLE 'FailureMechanismSectionEntity'
 (
 	'FailureMechanismSectionEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -405,15 +408,6 @@
 )
 ;
 
-CREATE TABLE 'MacroStabilityOutwardsFailureMechanismMetaEntity'
-(
-	'MacroStabilityOutwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-	'FailureMechanismEntityId' INTEGER NOT NULL,
-	'A' REAL NOT NULL,
-	CONSTRAINT 'FK_MacroStabilityOutwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
-)
-;
-
 CREATE TABLE 'FailureMechanismEntity'
 (
 	'FailureMechanismEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -586,17 +580,6 @@
 )
 ;
 
-CREATE TABLE 'StabilityPointStructuresFailureMechanismMetaEntity'
-(
-	'StabilityPointStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-	'FailureMechanismEntityId' INTEGER NOT NULL,
-	'N' REAL NOT NULL,
-	'ForeshoreProfileCollectionSourcePath' TEXT,
-	'StabilityPointStructureCollectionSourcePath' TEXT,
-	CONSTRAINT 'FK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
-)
-;
-
 CREATE TABLE 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
 (
 	'GrassCoverErosionInwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -607,12 +590,14 @@
 )
 ;
 
-CREATE TABLE 'DuneErosionFailureMechanismMetaEntity'
+CREATE TABLE 'StabilityPointStructuresFailureMechanismMetaEntity'
 (
-	'DuneErosionFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+	'StabilityPointStructuresFailureMechanismMetaEntityId' 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
+	'ForeshoreProfileCollectionSourcePath' TEXT,
+	'StabilityPointStructureCollectionSourcePath' TEXT,
+	CONSTRAINT 'FK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
 )
 ;
 
@@ -644,6 +629,15 @@
 )
 ;
 
+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 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
 (
 	'GrassCoverErosionOutwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -672,17 +666,6 @@
 )
 ;
 
-CREATE TABLE 'HeightStructuresFailureMechanismMetaEntity'
-(
-	'HeightStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-	'FailureMechanismEntityId' INTEGER NOT NULL,
-	'N' REAL NOT NULL,
-	'HeightStructureCollectionSourcePath' TEXT,
-	'ForeshoreProfileCollectionSourcePath' TEXT,
-	CONSTRAINT 'FK_HeightStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
-)
-;
-
 CREATE TABLE 'PipingSoilLayerEntity'
 (
 	'PipingSoilLayerEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -703,6 +686,17 @@
 )
 ;
 
+CREATE TABLE 'HeightStructuresFailureMechanismMetaEntity'
+(
+	'HeightStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+	'FailureMechanismEntityId' INTEGER NOT NULL,
+	'N' REAL NOT NULL,
+	'HeightStructureCollectionSourcePath' TEXT,
+	'ForeshoreProfileCollectionSourcePath' TEXT,
+	CONSTRAINT 'FK_HeightStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
 CREATE TABLE 'PipingSoilProfileEntity'
 (
 	'PipingSoilProfileEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
@@ -1148,7 +1142,7 @@
 	'GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 	'CalculationGroupEntityId' INTEGER NOT NULL,
 	'ForeshoreProfileEntityId' INTEGER,
-	'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER,
+	'HydraulicLocationEntityId' INTEGER,
 	'Order' INT (4) NOT NULL,
 	'Name' VARCHAR (260),
 	'Comments' TEXT,
@@ -1164,25 +1158,10 @@
 	'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
+	CONSTRAINT 'FK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') 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,
-	'ShouldWaveHeightIllustrationPointsBeCalculated' TINYINT (1) NOT NULL, -- true or false
-	'ShouldDesignWaterLevelIllustrationPointsBeCalculated' TINYINT (1) NOT NULL, -- true or false
-	'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,
@@ -1470,24 +1449,6 @@
 )
 ;
 
-CREATE TABLE 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity'
-(
-	'GrassCoverErosionOutwardsHydraulicLocationOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-	'GrassCoverErosionOutwardsHydraulicLocationEntityId' INTEGER NOT NULL,
-	'GeneralResultSubMechanismIllustrationPointEntityId' INTEGER,
-	'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_GeneralResultSubMechanismIllustrationPointEntity' FOREIGN KEY ('GeneralResultSubMechanismIllustrationPointEntityId') REFERENCES 'GeneralResultSubMechanismIllustrationPointEntity' ('GeneralResultSubMechanismIllustrationPointEntityId') ON DELETE Set Null ON UPDATE Cascade,
-	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,
@@ -2057,14 +2018,14 @@
 END; 
 ;
 
-CREATE INDEX 'IXFK_FailureMechanismSectionEntity_FailureMechanismEntity'
- ON 'FailureMechanismSectionEntity' ('FailureMechanismEntityId' ASC)
-;
-
 CREATE INDEX 'IXFK_MacroStabilityOutwardsFailureMechanismMetaEntity_FailureMechanismEntity'
  ON 'MacroStabilityOutwardsFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
 ;
 
+CREATE INDEX 'IXFK_FailureMechanismSectionEntity_FailureMechanismEntity'
+ ON 'FailureMechanismSectionEntity' ('FailureMechanismEntityId' ASC)
+;
+
 CREATE INDEX 'IXFK_FailureMechanismEntity_AssessmentSectionEntity'
  ON 'FailureMechanismEntity' ('AssessmentSectionEntityId' ASC)
 ;
@@ -2125,16 +2086,12 @@
  ON 'PipingCalculationEntity' ('CalculationGroupEntityId' ASC)
 ;
 
-CREATE INDEX 'IXFK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity'
- ON 'StabilityPointStructuresFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
-;
-
 CREATE INDEX 'IXFK_GrassCoverErosionInwardsFailureMechanismMetaEntity_FailureMechanismEntity'
  ON 'GrassCoverErosionInwardsFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
 ;
 
-CREATE INDEX 'IXFK_DuneErosionFailureMechanismMetaEntity_FailureMechanismEntity'
- ON 'DuneErosionFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
+CREATE INDEX 'IXFK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity'
+ ON 'StabilityPointStructuresFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
 ;
 
 CREATE INDEX 'IXFK_GrassCoverErosionInwardsCalculationEntity_CalculationGroupEntity'
@@ -2149,6 +2106,10 @@
  ON 'GrassCoverErosionInwardsCalculationEntity' ('HydraulicLocationEntityId' ASC)
 ;
 
+CREATE INDEX 'IXFK_DuneErosionFailureMechanismMetaEntity_FailureMechanismEntity'
+ ON 'DuneErosionFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
+;
+
 CREATE INDEX 'IXFK_GrassCoverErosionOutwardsFailureMechanismMetaEntity_FailureMechanismEntity'
  ON 'GrassCoverErosionOutwardsFailureMechanismMetaEntity' ('FailureMechanismEntityId' ASC)
 ;
@@ -2385,14 +2346,10 @@
  ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('ForeshoreProfileEntityId' ASC)
 ;
 
-CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_GrassCoverErosionOutwardsHydraulicLocationEntity'
- ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC)
+CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsCalculationEntity_HydraulicLocationEntity'
+ ON 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity' ('HydraulicLocationEntityId' ASC)
 ;
 
-CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationEntity_FailureMechanismEntity'
- ON 'GrassCoverErosionOutwardsHydraulicLocationEntity' ('FailureMechanismEntityId' ASC)
-;
-
 CREATE INDEX 'IXFK_GrassCoverErosionOutwardsWaveConditionsOutputEntity_GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
  ON 'GrassCoverErosionOutwardsWaveConditionsOutputEntity' ('GrassCoverErosionOutwardsWaveConditionsCalculationEntityId' ASC)
 ;
@@ -2505,25 +2462,6 @@
 END; 
 ;
 
-CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GeneralResultSubMechanismIllustrationPointEntity'
- ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GeneralResultSubMechanismIllustrationPointEntityId' ASC)
-;
-
-CREATE INDEX 'IXFK_GrassCoverErosionOutwardsHydraulicLocationOutputEntity_GrassCoverErosionOutwardsHydraulicLocationEntity'
- ON 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity' ('GrassCoverErosionOutwardsHydraulicLocationEntityId' ASC)
-;
-CREATE TRIGGER [TR_AfterDeleteGrassCoverErosionOutwardsHydraulicLocationOutputEntity_RemoveGeneralResultSubMechanismIllustrationPointEntity]
-	AFTER DELETE
-	ON GrassCoverErosionOutwardsHydraulicLocationOutputEntity
-	FOR EACH ROW
-BEGIN
-	DELETE
-	FROM GeneralResultSubMechanismIllustrationPointEntity
-	WHERE OLD.GeneralResultSubMechanismIllustrationPointEntityId IS NOT NULL 
-	AND GeneralResultSubMechanismIllustrationPointEntityId IS OLD.GeneralResultSubMechanismIllustrationPointEntityId;
-END; 
-;
-
 CREATE INDEX 'IXFK_DuneLocationEntity_FailureMechanismEntity'
  ON 'DuneLocationEntity' ('FailureMechanismEntityId' ASC)
 ;
