Index: Migration/Core/src/Migration.Core.Storage/Properties/Resources.Designer.cs =================================================================== diff -u -rb5aa83e7766c6fccd8ad0bc55eca6548c3da43de -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Core/src/Migration.Core.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b5aa83e7766c6fccd8ad0bc55eca6548c3da43de) +++ Migration/Core/src/Migration.Core.Storage/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -111,12 +111,30 @@ } /// + /// Looks up a localized string similar to Het is niet mogelijk om versie {0} te migreren naar versie {1}. + /// + internal static string Migrate_From_Version_0_To_Version_1_Not_Supported { + get { + return ResourceManager.GetString("Migrate_From_Version_0_To_Version_1_Not_Supported", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Er is een onverwachte fout opgetreden tijdens het verplaatsen van het gemigreerde bestand '{0}' naar '{1}'.. /// internal static string Migrate_Unable_To_Move_From_Location_0_To_Location_1 { get { return ResourceManager.GetString("Migrate_Unable_To_Move_From_Location_0_To_Location_1", resourceCulture); } } + + /// + /// Looks up a localized string similar to Het upgraden van versie {0} is niet ondersteund.. + /// + internal static string Upgrade_Version_0_Not_Supported { + get { + return ResourceManager.GetString("Upgrade_Version_0_Not_Supported", resourceCulture); + } + } } } Index: Migration/Core/src/Migration.Core.Storage/Properties/Resources.resx =================================================================== diff -u -rb5aa83e7766c6fccd8ad0bc55eca6548c3da43de -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Core/src/Migration.Core.Storage/Properties/Resources.resx (.../Resources.resx) (revision b5aa83e7766c6fccd8ad0bc55eca6548c3da43de) +++ Migration/Core/src/Migration.Core.Storage/Properties/Resources.resx (.../Resources.resx) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -124,4 +124,10 @@ Er is een onverwachte fout opgetreden tijdens het verplaatsen van het gemigreerde bestand '{0}' naar '{1}'. + + Het upgraden van versie {0} is niet ondersteund. + + + Het is niet mogelijk om versie {0} te migreren naar versie {1} + \ No newline at end of file Index: Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs =================================================================== diff -u -rb5aa83e7766c6fccd8ad0bc55eca6548c3da43de -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision b5aa83e7766c6fccd8ad0bc55eca6548c3da43de) +++ Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -28,6 +27,7 @@ using Migration.Core.Storage.Properties; using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; +using Ringtoets.Common.Utils; using MigrationScriptsDataResources = Migration.Scripts.Data.Properties.Resources; namespace Migration.Core.Storage @@ -39,6 +39,7 @@ { private readonly IOrderedEnumerable migrationScripts; private readonly Assembly scriptResource; + private readonly RingtoetsVersionComparer ringtoetsVersionComparer; /// /// Creates a new instance of the class. @@ -49,6 +50,7 @@ migrationScripts = GetAvailableMigrations() .OrderBy(ms => ms.SupportedVersion()) .ThenByDescending(ms => ms.TargetVersion()); + ringtoetsVersionComparer = new RingtoetsVersionComparer(); } /// @@ -69,9 +71,9 @@ /// The version to upgrade to. /// true if needs to be upgraded to , /// false otherwise. - public static bool NeedsMigrade(VersionedFile versionedFile, string toVersion) + public bool NeedsMigrade(VersionedFile versionedFile, string toVersion) { - return string.Compare(versionedFile.GetVersion(), toVersion, StringComparison.InvariantCulture) > 0; + return ringtoetsVersionComparer.Compare(versionedFile.GetVersion(), toVersion) < 0; } /// @@ -80,22 +82,24 @@ /// The source versioned file to migrate from. /// The version to upgrade to. /// The location where the migrated file needs to be saved. - /// Thrown when moving the migrated file - /// from a temporary environment to . + /// Thrown when migrating + /// to a new version on location failed. public void Migrate(VersionedFile fromVersionedFile, string toVersion, string newFileLocation) { - var supportedMigrationScripts = migrationScripts - .Where(ms => ms.SupportedVersion() - .Equals(fromVersionedFile.GetVersion())); + string fromVersion = fromVersionedFile.GetVersion(); + if (!IsVersionSupported(fromVersion)) + { + throw new CriticalDatabaseMigrationException(string.Format(Resources.Upgrade_Version_0_Not_Supported, + fromVersion)); + } - if (!supportedMigrationScripts.Any()) + MigrationScript migrationScript = GetMigrationScript(fromVersion, toVersion); + if (migrationScript == null) { - return; + throw new CriticalDatabaseMigrationException(string.Format(Resources.Migrate_From_Version_0_To_Version_1_Not_Supported, + fromVersion, toVersion)); } - MigrationScript migrationScript = supportedMigrationScripts.FirstOrDefault(ms => ms.TargetVersion().Equals(toVersion)) - ?? supportedMigrationScripts.First(); - var upgradedVersionFile = migrationScript.Upgrade(fromVersionedFile); if (!upgradedVersionFile.GetVersion().Equals(toVersion)) { @@ -116,6 +120,20 @@ } } + private MigrationScript GetMigrationScript(string fromVersion, string toVersion) + { + var supportedMigrationScripts = migrationScripts.Where(ms => ms.SupportedVersion() + .Equals(fromVersion)); + + if (!supportedMigrationScripts.Any()) + { + return null; + } + + return supportedMigrationScripts.FirstOrDefault(ms => ms.TargetVersion().Equals(toVersion)) + ?? supportedMigrationScripts.FirstOrDefault(ms => ringtoetsVersionComparer.Compare(toVersion, ms.TargetVersion()) > 0); + } + private IEnumerable GetAvailableMigrations() { IEnumerable migrationStreams = GetAvailableUpgradeScripts(); Index: Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs =================================================================== diff -u -re056ed42c497b9d4a88cebdca3032ecdb86b8cf1 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision e056ed42c497b9d4a88cebdca3032ecdb86b8cf1) +++ Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -78,9 +78,10 @@ // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); VersionedFile versionedFile = new VersionedFile(sourceFilePath); + var migrator = new VersionedFileMigrator(); // Call - bool needsMigrade = VersionedFileMigrator.NeedsMigrade(versionedFile, "17.1"); + bool needsMigrade = migrator.NeedsMigrade(versionedFile, "17.1"); // Assert Assert.IsTrue(needsMigrade); @@ -92,9 +93,10 @@ // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); VersionedFile versionedFile = new VersionedFile(sourceFilePath); + var migrator = new VersionedFileMigrator(); // Call - bool needsMigrade = VersionedFileMigrator.NeedsMigrade(versionedFile, "4"); + bool needsMigrade = migrator.NeedsMigrade(versionedFile, "4"); // Assert Assert.IsFalse(needsMigrade); @@ -119,7 +121,7 @@ { Assert.Fail($"File was not created at location '{targetFilePath}'"); } - + var toVersionedFile = new VersionedFile(targetFilePath); Assert.AreEqual(newVersion, toVersionedFile.GetVersion()); using (new FileDisposeHelper(targetFilePath)) {} Index: Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj =================================================================== diff -u -r83fbfb9ccbeaef0916d3485f89d48fdae9b8eb1d -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 83fbfb9ccbeaef0916d3485f89d48fdae9b8eb1d) +++ Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -97,6 +97,9 @@ + + + Index: Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rf5120263f838eaf211d8f73ca08a78c22e9777fb -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f5120263f838eaf211d8f73ca08a78c22e9777fb) +++ Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -104,6 +104,35 @@ /// ///DROP TABLE IF E [rest of string was truncated]";. /// + public static string DatabaseStructure17_0 { + get { + return ResourceManager.GetString("DatabaseStructure17_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to /* ---------------------------------------------------- */ + ////* Generated by Enterprise Architect Version 12.0 */ + ////* Created On : 12-Jan-2017 2:31:23 PM */ + ////* 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 E [rest of string was truncated]";. + /// public static string DatabaseStructure17_1 { get { return ResourceManager.GetString("DatabaseStructure17_1", resourceCulture); Index: Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.resx =================================================================== diff -u -rf5120263f838eaf211d8f73ca08a78c22e9777fb -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.resx (.../Resources.resx) (revision f5120263f838eaf211d8f73ca08a78c22e9777fb) +++ Migration/Scripts/src/Migration.Scripts.Data/Properties/Resources.resx (.../Resources.resx) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -119,7 +119,7 @@ - ..\Resources\DatabaseStructure17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\DatabaseStructure17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\Migration_4_17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 @@ -133,4 +133,7 @@ Het bestand '{0}' is moet een geldig Ringtoets database bestand zijn. + + ..\Resources\DatabaseStructure17.0.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file Index: Migration/Scripts/src/Migration.Scripts.Data/Resources/DatabaseStructure17.0.sql =================================================================== diff -u --- Migration/Scripts/src/Migration.Scripts.Data/Resources/DatabaseStructure17.0.sql (revision 0) +++ Migration/Scripts/src/Migration.Scripts.Data/Resources/DatabaseStructure17.0.sql (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -0,0 +1,1683 @@ +/* ---------------------------------------------------- */ +/* Generated by Enterprise Architect Version 12.0 */ +/* Created On : 12-Jan-2017 2:31:23 PM */ +/* 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' +; + +/* 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, + 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, + 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, + 'Probability' REAL, + '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, + '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 +) +; + +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 +) +; + +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, + '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, + 'Name' VARCHAR (260), + '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 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) +; Index: Migration/Scripts/src/Migration.Scripts.Data/Resources/Migration_4_17.0.sql =================================================================== diff -u -r5aa0269872b446cab9f68c55dead92b6c5f49a64 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Migration/Scripts/src/Migration.Scripts.Data/Resources/Migration_4_17.0.sql (.../Migration_4_17.0.sql) (revision 5aa0269872b446cab9f68c55dead92b6c5f49a64) +++ Migration/Scripts/src/Migration.Scripts.Data/Resources/Migration_4_17.0.sql (.../Migration_4_17.0.sql) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -1,8 +1,20 @@ +ATTACH DATABASE [{0}] AS SOURCEPROJECT; + CREATE TABLE 'InvalidVersionScriptCalled' ( 'VersionId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, 'Version' INTEGER NOT NULL ) ; -INSERT INTO 'InvalidVersionScriptCalled' SET 'Version' = "17.0"; \ No newline at end of file +INSERT INTO 'InvalidVersionScriptCalled' ('Version') VALUES ("17.0"); +INSERT INTO VersionEntity ( + [VersionId], + [Version], + [Timestamp], + [FingerPrint]) +SELECT [VersionId], + "17.0", + [Timestamp], + [FingerPrint] + FROM [SOURCEPROJECT].VersionEntity; \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Utils/Ringtoets.Common.Utils.csproj =================================================================== diff -u -r2af16641280bfec489b54f50f4d32cb29260e0b8 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Ringtoets/Common/src/Ringtoets.Common.Utils/Ringtoets.Common.Utils.csproj (.../Ringtoets.Common.Utils.csproj) (revision 2af16641280bfec489b54f50f4d32cb29260e0b8) +++ Ringtoets/Common/src/Ringtoets.Common.Utils/Ringtoets.Common.Utils.csproj (.../Ringtoets.Common.Utils.csproj) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -41,6 +41,7 @@ + Index: Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionComparer.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionComparer.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionComparer.cs (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Ringtoets.Common.Utils +{ + /// + /// This class can be used to compare Ringtoets database files. + /// + public class RingtoetsVersionComparer : IComparer, IComparer + { + private const string versionSeparator = "."; + + public int Compare(object x, object y) + { + return Compare(x.ToString(), y.ToString()); + } + + public int Compare(string x, string y) + { + if (x == null || y == null) + { + return string.Compare(x, y, StringComparison.InvariantCulture); + } + var separatorArray = versionSeparator.ToCharArray(); + string[] firstVersionArray = x.Split(separatorArray, StringSplitOptions.RemoveEmptyEntries); + string[] secondVersionArray = y.Split(separatorArray, StringSplitOptions.RemoveEmptyEntries); + + if (firstVersionArray.Length < 1) + { + if (secondVersionArray.Length < 1) + { + return 0; + } + return -1; + } + + if (secondVersionArray.Length < 1) + { + return 1; + } + + int first; + int.TryParse(firstVersionArray[0], out first); + + int second; + int.TryParse(secondVersionArray[0], out second); + + var compareTo = first.CompareTo(second); + if (compareTo > 0) + { + return compareTo; + } + if (compareTo == 0 && (firstVersionArray.Length > 1 || secondVersionArray.Length > 1)) + { + var newVersionString = string.Join(versionSeparator, firstVersionArray.Skip(1).ToArray()); + var newCurrentVersionString = string.Join(versionSeparator, secondVersionArray.Skip(1).ToArray()); + return Compare(newVersionString, newCurrentVersionString); + } + return compareTo; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionHelper.cs =================================================================== diff -u -r2af16641280bfec489b54f50f4d32cb29260e0b8 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionHelper.cs (.../RingtoetsVersionHelper.cs) (revision 2af16641280bfec489b54f50f4d32cb29260e0b8) +++ Ringtoets/Common/src/Ringtoets.Common.Utils/RingtoetsVersionHelper.cs (.../RingtoetsVersionHelper.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -19,9 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; -using System.Linq; - namespace Ringtoets.Common.Utils { /// @@ -31,7 +28,6 @@ { private const string validDatabaseversion = "4"; private const string currentDatabaseVersion = "17.1"; - private const string versionSeparator = "."; /// /// Gets the current database version. @@ -50,7 +46,8 @@ /// database version, false otherwise. public static bool IsNewerThanCurrent(string version) { - return CompareToVersion(version, currentDatabaseVersion) > 0; + var versionComparer = new RingtoetsVersionComparer(); + return versionComparer.Compare(version, currentDatabaseVersion) > 0; } /// @@ -61,43 +58,8 @@ /// false otherwise. public static bool IsValidVersion(string version) { - return CompareToVersion(version, validDatabaseversion) >= 0; + var versionComparer = new RingtoetsVersionComparer(); + return versionComparer.Compare(version, validDatabaseversion) >= 0; } - - public static int CompareToVersion(string versionString, string compareString) - { - var separatorArray = versionSeparator.ToCharArray(); - string[] versionArray = versionString.Split(separatorArray, StringSplitOptions.RemoveEmptyEntries); - string[] currentVersionArray = compareString.Split(separatorArray, StringSplitOptions.RemoveEmptyEntries); - - if (versionArray.Length < 1) - { - return -1; - } - - if (currentVersionArray.Length < 1) - { - return 1; - } - - int version; - int.TryParse(versionArray[0], out version); - - int currentVersion; - int.TryParse(currentVersionArray[0], out currentVersion); - - var compareTo = version.CompareTo(currentVersion); - if (compareTo > 0) - { - return compareTo; - } - if (compareTo == 0 && versionArray.Length > 1) - { - var newVersionString = string.Join(versionSeparator, versionArray.Skip(1).ToArray()); - var newCurrentVersionString = string.Join(versionSeparator, currentVersionArray.Skip(1).ToArray()); - return CompareToVersion(newVersionString, newCurrentVersionString); - } - return compareTo; - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Utils.Test/Ringtoets.Common.Utils.Test.csproj =================================================================== diff -u -r2af16641280bfec489b54f50f4d32cb29260e0b8 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Ringtoets/Common/test/Ringtoets.Common.Utils.Test/Ringtoets.Common.Utils.Test.csproj (.../Ringtoets.Common.Utils.Test.csproj) (revision 2af16641280bfec489b54f50f4d32cb29260e0b8) +++ Ringtoets/Common/test/Ringtoets.Common.Utils.Test/Ringtoets.Common.Utils.Test.csproj (.../Ringtoets.Common.Utils.Test.csproj) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -56,6 +56,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionComparerTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionComparerTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionComparerTest.cs (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -0,0 +1,141 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; + +namespace Ringtoets.Common.Utils.Test +{ + [TestFixture] + public class RingtoetsVersionComparerTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var comparer = new RingtoetsVersionComparer(); + + // Assert + Assert.IsInstanceOf(comparer); + Assert.IsInstanceOf>(comparer); + } + + [Test] + [TestCase("", "0")] + [TestCase(0, 1)] + [TestCase(1.0, 1.1)] + public void CompareObject_FirstLessThanSecond_ReturnsLessThanZero(object first, object second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.Less(compare, 0); + } + + [Test] + [TestCase("0", "")] + [TestCase(1, 0)] + [TestCase(1.1, 1.0)] + public void CompareObject_FirstGreaterThanSecond_ReturnsMoreThanZero(object first, object second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.Greater(compare, 0); + } + + [Test] + [TestCase("", "")] + [TestCase(1, 1)] + [TestCase(1.1, 1.1)] + public void CompareObject_FirstEqualToSecond_ReturnsZero(object first, object second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.AreEqual(0, compare); + } + + [Test] + [TestCase(null, "")] + [TestCase("", "0")] + [TestCase("0", "1")] + [TestCase("1.0", "1.1")] + public void CompareString_FirstLessThanSecond_ReturnsLessThanZero(string first, string second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.Less(compare, 0); + } + + [Test] + [TestCase("", null)] + [TestCase("0", "")] + [TestCase("1", "0")] + [TestCase("1.1", "1.0")] + public void CompareString_FirstGreaterThanSecond_ReturnsGreaterThanZero(string first, string second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.Greater(compare, 0); + } + + [Test] + [TestCase(null, null)] + [TestCase("", "")] + [TestCase("1", "1")] + [TestCase("1.1", "1.1")] + public void CompareString_FirstEqualToSecond_ReturnsZero(string first, string second) + { + // Setup + var comparer = new RingtoetsVersionComparer(); + + // Call + int compare = comparer.Compare(first, second); + + // Assert + Assert.AreEqual(0, compare); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionHelperTest.cs =================================================================== diff -u -r2af16641280bfec489b54f50f4d32cb29260e0b8 -r24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077 --- Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionHelperTest.cs (.../RingtoetsVersionHelperTest.cs) (revision 2af16641280bfec489b54f50f4d32cb29260e0b8) +++ Ringtoets/Common/test/Ringtoets.Common.Utils.Test/RingtoetsVersionHelperTest.cs (.../RingtoetsVersionHelperTest.cs) (revision 24fff72c73f0e43ad9f9fcf3a616ab0f8f96e077) @@ -90,6 +90,7 @@ [TestCase("17")] public void IsValidVersion_ValidVersion_ReturnsTrue(string validVersion) { + // Call bool isNewer = RingtoetsVersionHelper.IsValidVersion(validVersion); // Assert @@ -101,6 +102,7 @@ [TestCase("..")] public void IsValidVersion_InvalidVersion_ReturnsFalse(string invalidVersion) { + // Call bool isNewer = RingtoetsVersionHelper.IsValidVersion(invalidVersion); // Assert