Index: build/DatabaseStructure.sql
===================================================================
diff -u -rb9a41aade97cb989edf90b0b15a2aebc614b7a59 -r0641053e020a1478f793ee17e753df60af26171f
--- build/DatabaseStructure.sql	(.../DatabaseStructure.sql)	(revision b9a41aade97cb989edf90b0b15a2aebc614b7a59)
+++ build/DatabaseStructure.sql	(.../DatabaseStructure.sql)	(revision 0641053e020a1478f793ee17e753df60af26171f)
@@ -1,6 +1,6 @@
 /* ---------------------------------------------------- */
 /*  Generated by Enterprise Architect Version 12.0 		*/
-/*  Created On : 15-Sep-2017 11:12:25 AM 				*/
+/*  Created On : 20-Sep-2017 9:43:01 AM 				*/
 /*  DBMS       : SQLite 								*/
 /* ---------------------------------------------------- */
 
@@ -322,7 +322,6 @@
 	'MacroStabilityInwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 	'FailureMechanismEntityId' INTEGER NOT NULL,
 	'A' REAL NOT NULL,
-	'SectionLength' REAL,
 	'StochasticSoilModelCollectionSourcePath' TEXT,
 	'SurfaceLineCollectionSourcePath' TEXT,
 	CONSTRAINT 'FK_MacroStabilityInwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
@@ -520,7 +519,7 @@
 	'PipingCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
 	'CalculationGroupEntityId' INTEGER NOT NULL,
 	'SurfaceLineEntityId' INTEGER,
-	'StochasticSoilProfileEntityId' INTEGER,
+	'PipingStochasticSoilProfileEntityId' INTEGER,
 	'HydraulicLocationEntityId' INTEGER,
 	'Order' INT (4) NOT NULL,
 	'Name' VARCHAR (260),
@@ -537,7 +536,7 @@
 	'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 'PipingStochasticSoilProfileEntity' ('PipingStochasticSoilProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
+	CONSTRAINT 'FK_PipingCalculationEntity_PipingStochasticSoilProfileEntity' FOREIGN KEY ('PipingStochasticSoilProfileEntityId') REFERENCES 'PipingStochasticSoilProfileEntity' ('PipingStochasticSoilProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
 	CONSTRAINT 'FK_PipingCalculationEntity_SurfaceLineEntity' FOREIGN KEY ('SurfaceLineEntityId') REFERENCES 'SurfaceLineEntity' ('SurfaceLineEntityId') ON DELETE Set Null ON UPDATE Cascade
 )
 ;
@@ -1680,7 +1679,7 @@
 	'IsAquifer' TINYINT (1) NOT NULL,
 	'Color' INTEGER NOT NULL, -- ARGB value of Color.
 	'MaterialName' TEXT NOT NULL,
-	'ShearStrengthModel' TINYINT (1) NOT NULL, -- Enumtype: 1 = None, 2 = SuCalculated, 3 = CPhi, 4 = CPhiOrSuCalculated
+	'ShearStrengthModel' TINYINT (1) NOT NULL, -- Enumtype: 1 = SuCalculated, 2 = CPhi, 3 = CPhiOrSuCalculated
 	'UsePop' TINYINT (1) NOT NULL, -- true of false
 	'AbovePhreaticLevelMean' REAL,
 	'AbovePhreaticLevelCoefficientOfVariation' REAL,
@@ -1718,8 +1717,8 @@
 	'IsAquifer' TINYINT (1) NOT NULL,
 	'Color' INTEGER, -- ARGB value of Color.
 	'MaterialName' TEXT NOT NULL,
-	'ShearStrengthModel' TINYINT (1) NOT NULL, -- Enumtype: 1 = None, 2 = SuCalculated, 3 = CPhi, 4 = CPhiOrSuCalculated
-	'UsePop' TINYINT (1) NOT NULL,
+	'ShearStrengthModel' TINYINT (1) NOT NULL, -- Enumtype: 1 = SuCalculated, 2 = CPhi, 3 = CPhiOrSuCalculated
+	'UsePop' TINYINT (1) NOT NULL, -- true of false
 	'AbovePhreaticLevelMean' REAL,
 	'AbovePhreaticLevelCoefficientOfVariation' REAL,
 	'AbovePhreaticLevelShift' REAL,
@@ -1736,8 +1735,8 @@
 	'StrengthIncreaseExponentCoefficientOfVariation' REAL,
 	'PopMean' REAL,
 	'PopCoefficientOfVariation' REAL,
-	'OuterRingXml' TEXT,
-	'HolesXml' TEXT,
+	'OuterRingXml' TEXT NOT NULL,
+	'HolesXml' TEXT NOT NULL,
 	'Order' INT (4) NOT NULL,
 	CONSTRAINT 'FK_MacroStabilityInwardsSoilLayerTwoDEntity_MacroStabilityInwardsSoilProfileTwoDEntity' FOREIGN KEY ('MacroStabilityInwardsSoilProfileTwoDEntityId') REFERENCES 'MacroStabilityInwardsSoilProfileTwoDEntity' ('MacroStabilityInwardsSoilProfileTwoDEntityId') ON DELETE Cascade ON UPDATE Cascade
 )
@@ -1858,8 +1857,8 @@
  ON 'HydraulicLocationEntity' ('AssessmentSectionEntityId' ASC)
 ;
 
-CREATE INDEX 'IXFK_PipingCalculationEntity_StochasticSoilProfileEntity'
- ON 'PipingCalculationEntity' ('StochasticSoilProfileEntityId' ASC)
+CREATE INDEX 'IXFK_PipingCalculationEntity_PipingStochasticSoilProfileEntity'
+ ON 'PipingCalculationEntity' ('PipingStochasticSoilProfileEntityId' ASC)
 ;
 
 CREATE INDEX 'IXFK_PipingCalculationEntity_SurfaceLineEntity'
@@ -2411,10 +2410,12 @@
 BEGIN
 	SELECT
 		CASE
-			WHEN NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NULL 
-				AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NULL
-				OR NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NOT NULL
-				AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NOT NULL
+			WHEN 
+			(
+				NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NULL AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NULL
+			) OR (
+				NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NOT NULL AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NOT NULL
+			)
 				THEN RAISE(FAIL, 'Either SoilProfile1D or SoilProfile2D must be set.')
 		END;
 END; 
@@ -2427,10 +2428,12 @@
 BEGIN
 	SELECT
 		CASE
-			WHEN NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NULL 
-				AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NULL
-				OR NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NOT NULL
-				AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NOT NULL
+			WHEN 
+			(
+				NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NULL AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NULL
+			) OR (
+				NEW.MacroStabilityInwardsSoilProfileOneDEntityId IS NOT NULL AND NEW.MacroStabilityInwardsSoilProfileTwoDEntityId IS NOT NULL
+			)
 				THEN RAISE(FAIL, 'Either SoilProfile1D or SoilProfile2D must be set.')
 		END;
 END; 
