Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Application.Ringtoets.Migration.Console.csproj
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Application.Ringtoets.Migration.Console.csproj (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Application.Ringtoets.Migration.Console.csproj (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,103 @@
+
+
+
+
+ {23C45BFD-0A07-400F-B216-DF0C74CC99A1}
+ Exe
+ Properties
+ Application.Ringtoets.Migration.Console
+ Migratiehulpprogramma
+ v4.0
+ 512
+
+
+ true
+ full
+ false
+ DEBUG;TRACE
+ prompt
+
+
+ none
+ true
+ TRACE
+ prompt
+
+
+ TRACE
+ true
+ true
+ pdbonly
+ prompt
+ AllRules.ruleset
+
+
+
+
+
+
+
+ Properties\GlobalAssembly.cs
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+
+
+ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
+ Core.Common.Utils
+ False
+
+
+ {2E2C9B96-E72A-4C10-AA54-A5381FE30B0D}
+ Migration.Console
+ False
+
+
+ {efd7e662-5b69-4b71-a448-565b64e9c033}
+ Migration.Core.Storage
+ False
+
+
+ {d08db9e2-6861-44c8-a725-71a70274cc77}
+ Migration.Scripts.Data
+ False
+
+
+ {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
+ Ringtoets.Common.Utils
+ False
+
+
+ {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
+ Application.Ringtoets.Migration.Core
+ False
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/AssemblyInfo.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/AssemblyInfo.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,27 @@
+// 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.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Migratiehulpprogramma")]
+[assembly: AssemblyProduct("Migratiehulpprogramma")]
+[assembly: Guid("23c45bfd-0a07-400f-b216-df0c74cc99a1")]
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.Designer.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.Designer.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.Designer.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,153 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Application.Ringtoets.Migration.Console.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Application.Ringtoets.Migration.Console.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} is geen geldige opdracht..
+ ///
+ internal static string CommandInvalid_Command_0_Is_not_valid {
+ get {
+ return ResourceManager.GetString("CommandInvalid_Command_0_Is_not_valid", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to MIGRATIEHULPPROGRAMMA bronprojectpad doelprojectpad.
+ ///
+ internal static string CommandMigrate_Brief {
+ get {
+ return ResourceManager.GetString("CommandMigrate_Brief", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Voert de migratie uit van het projectbestand dat te vinden is in het bronprojectpad en slaat het resulterende projectbestand op in het doelprojectpad..
+ ///
+ internal static string CommandMigrate_Detailed {
+ get {
+ return ResourceManager.GetString("CommandMigrate_Detailed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bron- en doelprojectpad moeten geldige bestandspaden zijn..
+ ///
+ internal static string CommandMigrate_Source_Or_Destination_Not_Valid_Path {
+ get {
+ return ResourceManager.GetString("CommandMigrate_Source_Or_Destination_Not_Valid_Path", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het projectbestand '{0}' is succesvol gemigreerd naar '{1}' (versie {2})..
+ ///
+ internal static string CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2 {
+ get {
+ return ResourceManager.GetString("CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to MIGRATIEHULPPROGRAMMA bronprojectpad.
+ ///
+ internal static string CommandSupported_Brief {
+ get {
+ return ResourceManager.GetString("CommandSupported_Brief", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Controleert of het projectbestand dat te vinden is in het bronprojectpad gemigreerd kan worden..
+ ///
+ internal static string CommandSupported_Detailed {
+ get {
+ return ResourceManager.GetString("CommandSupported_Detailed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het projectbestand kan gemigreerd worden naar versie '{0}'..
+ ///
+ internal static string CommandSupported_File_Able_To_Migrate_To_Version_0 {
+ get {
+ return ResourceManager.GetString("CommandSupported_File_Able_To_Migrate_To_Version_0", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Dit hulpprogramma kan worden gebruikt om een projectbestand in het formaat van een eerdere versie van Ringtoets te migreren naar het formaat van de huidige versie van Ringtoets ({0})..
+ ///
+ internal static string RingtoetsMigrationTool_ApplicationDescription_Version_0 {
+ get {
+ return ResourceManager.GetString("RingtoetsMigrationTool_ApplicationDescription_Version_0", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to MIGRATIEHULPPROGRAMMA.
+ ///
+ internal static string RingtoetsMigrationTool_ApplicationName {
+ get {
+ return ResourceManager.GetString("RingtoetsMigrationTool_ApplicationName", resourceCulture);
+ }
+ }
+ }
+}
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.resx
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.resx (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/Properties/Resources.resx (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ MIGRATIEHULPPROGRAMMA bronprojectpad doelprojectpad
+
+
+ Voert de migratie uit van het projectbestand dat te vinden is in het bronprojectpad en slaat het resulterende projectbestand op in het doelprojectpad.
+
+
+ Het projectbestand '{0}' is succesvol gemigreerd naar '{1}' (versie {2}).
+
+
+ MIGRATIEHULPPROGRAMMA bronprojectpad
+
+
+ Controleert of het projectbestand dat te vinden is in het bronprojectpad gemigreerd kan worden.
+
+
+ Dit hulpprogramma kan worden gebruikt om een projectbestand in het formaat van een eerdere versie van Ringtoets te migreren naar het formaat van de huidige versie van Ringtoets ({0}).
+
+
+ Het projectbestand kan gemigreerd worden naar versie '{0}'.
+
+
+ {0} is geen geldige opdracht.
+
+
+ MIGRATIEHULPPROGRAMMA
+
+
+ Bron- en doelprojectpad moeten geldige bestandspaden zijn.
+
+
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationConsole.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationConsole.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationConsole.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,142 @@
+// 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 Application.Ringtoets.Migration.Console.Properties;
+using Application.Ringtoets.Migration.Core;
+using Core.Common.Utils;
+using Migration.Console;
+using Ringtoets.Common.Utils;
+using MigrationCoreStorageResources = Migration.Core.Storage.Properties.Resources;
+
+namespace Application.Ringtoets.Migration.Console
+{
+ ///
+ /// Console application that can migrate a Ringtoets database file to a newer version.
+ ///
+ public class RingtoetsMigrationConsole : ConsoleBase
+ {
+ private static readonly string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public RingtoetsMigrationConsole() : base(Resources.RingtoetsMigrationTool_ApplicationName,
+ GetApplicationDescription()) {}
+
+ protected override void ExecuteCommand(string[] args)
+ {
+ switch (args.Length)
+ {
+ case 1:
+ IsVersionSupportedCommand(args[0]);
+ break;
+ case 2:
+ MigrateCommand(args[0], args[1]);
+ break;
+ default:
+ string command = string.Join(" ", args);
+ InvalidCommand(command);
+ break;
+ }
+ }
+
+ protected override void DisplayCommands()
+ {
+ ShowSupportedCommand();
+ ShowMigrateCommand();
+ }
+
+ private static string GetApplicationDescription()
+ {
+ return string.Format(Resources.RingtoetsMigrationTool_ApplicationDescription_Version_0, currentDatabaseVersion);
+ }
+
+ #region Commands
+
+ private static void InvalidCommand(string command)
+ {
+ throw new NotSupportedException(string.Format(Resources.CommandInvalid_Command_0_Is_not_valid, command));
+ }
+
+ private static void IsVersionSupportedCommand(string location)
+ {
+ ValidateIsVersionSupportedArgument(location);
+
+ RingtoetsVersionedFile versionedFile = new RingtoetsVersionedFile(location);
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ var version = versionedFile.GetVersion();
+
+ bool isSupported = migrator.IsVersionSupported(version);
+
+ if (isSupported)
+ {
+ System.Console.WriteLine(Resources.CommandSupported_File_Able_To_Migrate_To_Version_0, currentDatabaseVersion);
+ }
+ else
+ {
+ ConsoleHelper.WriteErrorLine(MigrationCoreStorageResources.Migrate_From_Version_0_To_Version_1_Not_Supported,
+ version, currentDatabaseVersion);
+ }
+ }
+
+ private static void ValidateIsVersionSupportedArgument(string location)
+ {
+ if (!IOUtils.IsValidFilePath(location))
+ {
+ throw new ArgumentException(Core.Properties.Resources.CommandSupported_Source_Not_Valid_Path);
+ }
+ }
+
+ private static void ShowSupportedCommand()
+ {
+ System.Console.WriteLine(Resources.CommandSupported_Brief);
+ ConsoleHelper.WriteCommandDescriptionLine(Resources.CommandSupported_Detailed);
+ }
+
+ private static void MigrateCommand(string filepath, string toFilepath)
+ {
+ ValidateMigrationArguments(filepath, toFilepath);
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+ var sourceFile = new RingtoetsVersionedFile(filepath);
+
+ migrator.Migrate(sourceFile, currentDatabaseVersion, toFilepath);
+ System.Console.WriteLine(Resources.CommandMigrate_Successful_Migration_From_Location_0_To_Location_1_Version_2,
+ filepath, toFilepath, currentDatabaseVersion);
+ }
+
+ private static void ValidateMigrationArguments(string filepath, string toFilepath)
+ {
+ if (!(IOUtils.IsValidFilePath(filepath) && IOUtils.IsValidFilePath(toFilepath)))
+ {
+ throw new ArgumentException(Resources.CommandMigrate_Source_Or_Destination_Not_Valid_Path);
+ }
+ }
+
+ private static void ShowMigrateCommand()
+ {
+ System.Console.WriteLine(Resources.CommandMigrate_Brief);
+ ConsoleHelper.WriteCommandDescriptionLine(Resources.CommandMigrate_Detailed);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationTool.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationTool.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Console/RingtoetsMigrationTool.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,44 @@
+// 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.
+
+namespace Application.Ringtoets.Migration.Console
+{
+ ///
+ /// Entry point to the console application that can migrate a Ringtoets database file to a newer version.
+ ///
+ public static class RingtoetsMigrationTool
+ {
+ ///
+ /// Main Ringtoets migration application.
+ ///
+ /// Arguments
+ /// Accepted commands:
+ /// --help Shows help menu,
+ /// --supported Returns if the database file is supported,
+ /// --migrate Migrates the database file to a newer version.
+ ///
+ public static void Main(string[] args)
+ {
+ var ringtoetsMigrationTool = new RingtoetsMigrationConsole();
+ ringtoetsMigrationTool.ExecuteConsoleTool(args);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Application.Ringtoets.Migration.Core.csproj
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Application.Ringtoets.Migration.Core.csproj (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Application.Ringtoets.Migration.Core.csproj (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,127 @@
+
+
+
+
+ {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
+ Library
+ Properties
+ Application.Ringtoets.Migration.Core
+ Application.Ringtoets.Migration.Core
+ v4.0
+ 512
+
+
+ true
+ full
+ false
+ DEBUG;TRACE
+ prompt
+
+
+ none
+ true
+ TRACE
+ prompt
+
+
+ TRACE
+ true
+ true
+ pdbonly
+ prompt
+ AllRules.ruleset
+
+
+
+
+
+
+ ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
+ True
+
+
+
+
+ Properties\GlobalAssembly.cs
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+ False
+
+
+ {e344867e-9ac9-44c8-88a5-8185681679a9}
+ Core.Common.IO
+ False
+
+
+ {f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
+ Core.Common.Utils
+ False
+
+
+ {EFD7E662-5B69-4B71-A448-565B64E9C033}
+ Migration.Core.Storage
+ False
+
+
+ {D08DB9E2-6861-44C8-A725-71A70274CC77}
+ Migration.Scripts.Data
+ False
+
+
+ {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
+ Ringtoets.Common.Utils
+ False
+
+
+
+
+ PublicResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/AssemblyInfo.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/AssemblyInfo.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,27 @@
+// 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.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Application.Ringtoets.Migration.Core")]
+[assembly: AssemblyProduct("Application.Ringtoets.Migration.Core")]
+[assembly: Guid("fac55b92-e259-43d6-b9a1-5bda6c834359")]
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.Designer.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.Designer.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.Designer.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,149 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Application.Ringtoets.Migration.Core.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Application.Ringtoets.Migration.Core.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bronprojectpad moet een geldig bestandspad zijn..
+ ///
+ public static string CommandSupported_Source_Not_Valid_Path {
+ get {
+ return ResourceManager.GetString("CommandSupported_Source_Not_Valid_Path", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to /* ---------------------------------------------------- */
+ ////* Generated by Enterprise Architect Version 12.0 */
+ ////* Created On : 15-feb-2017 11:11:55 */
+ ////* 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 EXI [rest of string was truncated]";.
+ ///
+ public static string DatabaseStructure17_1 {
+ get {
+ return ResourceManager.GetString("DatabaseStructure17_1", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to /*
+ ///Migration script for migrating Ringtoets databases.
+ ///SourceProject version: 5
+ ///TargetProject version: 17.1
+ ///*/
+ ///PRAGMA foreign_keys = OFF;
+ ///
+ ///ATTACH DATABASE [{0}] AS SOURCEPROJECT;
+ ///
+ ///INSERT INTO AssessmentSectionEntity SELECT * FROM [SOURCEPROJECT].AssessmentSectionEntity;
+ ///INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity;
+ ///INSERT INTO CharacteristicPointEntity SELECT * FROM [SOURCEPROJECT].CharacteristicPointEntity;
+ ///INSERT INTO ClosingStructureEntity SELECT * F [rest of string was truncated]";.
+ ///
+ public static string Migration_5_171 {
+ get {
+ return ResourceManager.GetString("Migration_5_171", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het aanmaken van het Ringtoets projectbestand met versie '{0}' is mislukt..
+ ///
+ public static string RingtoetsCreateScript_Creating_Version_0_Failed {
+ get {
+ return ResourceManager.GetString("RingtoetsCreateScript_Creating_Version_0_Failed", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het bestand '{0}' moet een geldig Ringtoets projectbestand zijn..
+ ///
+ public static string RingtoetsDatabaseSourceFile_Invalid_Ringtoets_File_Path_0 {
+ get {
+ return ResourceManager.GetString("RingtoetsDatabaseSourceFile_Invalid_Ringtoets_File_Path_0", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Het migreren van het Ringtoets projectbestand van versie '{0}' naar '{1}' is mislukt..
+ ///
+ public static string RingtoetsUpgradeScript_Upgrading_Version_0_To_Version_1_Failed {
+ get {
+ return ResourceManager.GetString("RingtoetsUpgradeScript_Upgrading_Version_0_To_Version_1_Failed", resourceCulture);
+ }
+ }
+ }
+}
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.resx
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.resx (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Properties/Resources.resx (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\DatabaseStructure17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1
+
+
+ ..\Resources\Migration_5_17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252
+
+
+ Het bestand '{0}' moet een geldig Ringtoets projectbestand zijn.
+
+
+ Het aanmaken van het Ringtoets projectbestand met versie '{0}' is mislukt.
+
+
+ Het migreren van het Ringtoets projectbestand van versie '{0}' naar '{1}' is mislukt.
+
+
+ Bronprojectpad moet een geldig bestandspad zijn.
+
+
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/DatabaseStructure17.1.sql (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,1706 @@
+/* ---------------------------------------------------- */
+/* Generated by Enterprise Architect Version 12.0 */
+/* Created On : 15-feb-2017 11:11:55 */
+/* DBMS : SQLite */
+/* ---------------------------------------------------- */
+
+/* Drop Tables */
+
+DROP TABLE IF EXISTS 'VersionEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionInwardsDikeHeightOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'ProjectEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityPointStructuresCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'AssessmentSectionEntity'
+;
+
+DROP TABLE IF EXISTS 'FailureMechanismEntity'
+;
+
+DROP TABLE IF EXISTS 'FailureMechanismSectionEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityPointStructuresFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'ClosingStructuresFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'DuneErosionFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'CalculationGroupEntity'
+;
+
+DROP TABLE IF EXISTS 'HeightStructuresFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'HydraulicLocationEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionInwardsCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsFailureMechanismMetaEntity'
+;
+
+DROP TABLE IF EXISTS 'SoilLayerEntity'
+;
+
+DROP TABLE IF EXISTS 'SoilProfileEntity'
+;
+
+DROP TABLE IF EXISTS 'StochasticSoilProfileEntity'
+;
+
+DROP TABLE IF EXISTS 'StochasticSoilModelEntity'
+;
+
+DROP TABLE IF EXISTS 'SurfaceLineEntity'
+;
+
+DROP TABLE IF EXISTS 'CharacteristicPointEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingCalculationOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingSemiProbabilisticOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionInwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'HeightStructuresSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'StrengthStabilityLengthwiseConstructionSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'TechnicalInnovationSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'WaterPressureAsphaltCoverSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'ClosingStructuresSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverSlipOffInwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverSlipOffOutwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'MacrostabilityInwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'MacrostabilityOutwardsSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'MicrostabilitySectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'PipingStructureSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'DuneErosionSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityStoneCoverSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityPointStructuresSectionResultEntity'
+;
+
+DROP TABLE IF EXISTS 'DikeProfileEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionInwardsOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'ForeshoreProfileEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityStoneCoverWaveConditionsOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverWaveConditionsCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'WaveImpactAsphaltCoverWaveConditionsOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsWaveConditionsOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'HeightStructuresOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'HeightStructureEntity'
+;
+
+DROP TABLE IF EXISTS 'HeightStructuresCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'ClosingStructureEntity'
+;
+
+DROP TABLE IF EXISTS 'ClosingStructuresCalculationEntity'
+;
+
+DROP TABLE IF EXISTS 'ClosingStructuresOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityPointStructureEntity'
+;
+
+DROP TABLE IF EXISTS 'StabilityPointStructuresOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'HydraulicLocationOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'GrassCoverErosionOutwardsHydraulicLocationOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'DuneLocationEntity'
+;
+
+DROP TABLE IF EXISTS 'DuneLocationOutputEntity'
+;
+
+DROP TABLE IF EXISTS 'BackgroundMapDataEntity'
+;
+
+/* Create Tables with Primary and Foreign Keys, Check and Unique Constraints */
+
+CREATE TABLE 'VersionEntity'
+(
+ 'VersionId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'Version' VARCHAR (20) NOT NULL,
+ 'Timestamp' DATETIME NOT NULL,
+ 'FingerPrint' BLOB NOT NULL
+)
+;
+
+CREATE TABLE 'GrassCoverErosionInwardsDikeHeightOutputEntity'
+(
+ 'GrassCoverErosionInwardsDikeHeightOutputEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'GrassCoverErosionInwardsOutputEntityId' INTEGER NOT NULL,
+ 'DikeHeight' REAL,
+ 'TargetProbability' REAL,
+ 'TargetReliability' REAL,
+ 'CalculatedProbability' REAL,
+ 'CalculatedReliability' REAL,
+ 'CalculationConvergence' TINYINT (1) NOT NULL, -- Enum: 1 = NotCalculated, 2 = CalculationNotConverged, 3 = CalculationConverged
+ CONSTRAINT 'FK_GrassCoverErosionInwardsDikeHeightOutputEntity_GrassCoverErosionInwardsOutputEntity' FOREIGN KEY ('GrassCoverErosionInwardsOutputEntityId') REFERENCES 'GrassCoverErosionInwardsOutputEntity' ('GrassCoverErosionInwardsOutputEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'U_GrassCoverErosionInwardsOutputEntity' UNIQUE ('GrassCoverErosionInwardsOutputEntityId')
+)
+;
+
+CREATE TABLE 'ProjectEntity'
+(
+ 'ProjectEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'Description' VARCHAR (260)
+)
+;
+
+CREATE TABLE 'StabilityPointStructuresCalculationEntity'
+(
+ 'StabilityPointStructuresCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'CalculationGroupEntityId' INTEGER NOT NULL,
+ 'ForeshoreProfileEntityId' INTEGER,
+ 'HydraulicLocationEntityId' INTEGER,
+ 'StabilityPointStructureEntityId' INTEGER,
+ 'Order' INT (4) NOT NULL,
+ 'Name' VARCHAR (260),
+ 'Comments' TEXT,
+ 'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
+ 'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
+ 'BreakWaterHeight' REAL,
+ 'UseForeshore' TINYINT (1) NOT NULL, -- true or false
+ 'StructureNormalOrientation' REAL,
+ 'StorageStructureAreaMean' REAL,
+ 'StorageStructureAreaCoefficientOfVariation' REAL,
+ 'AllowedLevelIncreaseStorageMean' REAL,
+ 'AllowedLevelIncreaseStorageStandardDeviation' REAL,
+ 'WidthFlowAperturesMean' REAL,
+ 'WidthFlowAperturesStandardDeviation' REAL,
+ 'InsideWaterLevelMean' REAL,
+ 'InsideWaterLevelStandardDeviation' REAL,
+ 'ThresholdHeightOpenWeirMean' REAL,
+ 'ThresholdHeightOpenWeirStandardDeviation' REAL,
+ 'CriticalOvertoppingDischargeMean' REAL,
+ 'CriticalOvertoppingDischargeCoefficientOfVariation' REAL,
+ 'FlowWidthAtBottomProtectionMean' REAL,
+ 'FlowWidthAtBottomProtectionStandardDeviation' REAL,
+ 'ConstructiveStrengthLinearLoadModelMean' REAL,
+ 'ConstructiveStrengthLinearLoadModelCoefficientOfVariation' REAL,
+ 'ConstructiveStrengthQuadraticLoadModelMean' REAL,
+ 'ConstructiveStrengthQuadraticLoadModelCoefficientOfVariation' REAL,
+ 'BankWidthMean' REAL,
+ 'BankWidthStandardDeviation' REAL,
+ 'InsideWaterLevelFailureConstructionMean' REAL,
+ 'InsideWaterLevelFailureConstructionStandardDeviation' REAL,
+ 'EvaluationLevel' REAL,
+ 'LevelCrestStructureMean' REAL,
+ 'LevelCrestStructureStandardDeviation' REAL,
+ 'VerticalDistance' REAL,
+ 'FailureProbabilityRepairClosure' REAL NOT NULL,
+ 'FailureCollisionEnergyMean' REAL,
+ 'FailureCollisionEnergyCoefficientOfVariation' REAL,
+ 'ShipMassMean' REAL,
+ 'ShipMassCoefficientOfVariation' REAL,
+ 'ShipVelocityMean' REAL,
+ 'ShipVelocityCoefficientOfVariation' REAL,
+ 'LevellingCount' INT (4) NOT NULL,
+ 'ProbabilityCollisionSecondaryStructure' REAL NOT NULL,
+ 'FlowVelocityStructureClosableMean' REAL,
+ 'StabilityLinearLoadModelMean' REAL,
+ 'StabilityLinearLoadModelCoefficientOfVariation' REAL,
+ 'StabilityQuadraticLoadModelMean' REAL,
+ 'StabilityQuadraticLoadModelCoefficientOfVariation' REAL,
+ 'AreaFlowAperturesMean' REAL,
+ 'AreaFlowAperturesStandardDeviation' REAL,
+ 'InflowModelType' TINYINT (1) NOT NULL, -- Enum: 1 = VerticalWall, 2 = LowSill, 3 = FloodedCulvert
+ 'LoadSchematizationType' TINYINT (1) NOT NULL, -- Enum: 1 = Linear, 2 = Quadratic
+ 'VolumicWeightWater' REAL,
+ 'StormDurationMean' REAL,
+ 'ModelFactorSuperCriticalFlowMean' REAL,
+ 'FactorStormDurationOpenStructure' REAL,
+ 'DrainCoefficientMean' REAL,
+ 'FailureProbabilityStructureWithErosion' REAL NOT NULL,
+ CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_ForeshoreProfileEntity' FOREIGN KEY ('ForeshoreProfileEntityId') REFERENCES 'ForeshoreProfileEntity' ('ForeshoreProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
+ CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade,
+ CONSTRAINT 'FK_StabilityPointStructuresCalculationEntity_StabilityPointStructureEntity' FOREIGN KEY ('StabilityPointStructureEntityId') REFERENCES 'StabilityPointStructureEntity' ('StabilityPointStructureEntityId') ON DELETE Set Null ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'AssessmentSectionEntity'
+(
+ 'AssessmentSectionEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'ProjectEntityId' INTEGER NOT NULL,
+ 'Id' TEXT,
+ 'Name' VARCHAR (260),
+ 'Comments' TEXT,
+ 'Norm' REAL NOT NULL,
+ 'HydraulicDatabaseVersion' TEXT,
+ 'HydraulicDatabaseLocation' TEXT,
+ 'Composition' TINYINT (1) NOT NULL, -- Enum: 1 = Dike, 2 = Dune, 3 = DikeAndDune
+ 'ReferenceLinePointXml' TEXT,
+ 'Order' INT (4) NOT NULL,
+ CONSTRAINT 'FK_AssessmentSectionEntity_ProjectEntity' FOREIGN KEY ('ProjectEntityId') REFERENCES 'ProjectEntity' ('ProjectEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'FailureMechanismEntity'
+(
+ 'FailureMechanismEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'AssessmentSectionEntityId' INTEGER NOT NULL,
+ 'CalculationGroupEntityId' INTEGER,
+ 'FailureMechanismType' SMALLINT NOT NULL, -- Enum: 1 = Piping, 2 = Macrostabiliteit binnenwaarts, 3= Golfklappen op asfaltbekleding, 4= Grasbekleding erosie buitentalud, 5 = Grasbekleding afschuiven buitentalud, 6 = Grasbekleding erosie kruin en binnentalud, 7 = Stabiliteit steenzetting, 8 = Duinafslag, 9 = Hoogte kunstwerk, 10 = Betrouwbaarheid sluiten kunstwerk, 11 = Piping bij kunstwerk, 12 = Sterkte en stabiliteit puntconstructires, 13 = Macrostabiliteit buitenwaarts, 14 = Microstabiliteit, 15 = Wateroverdruk bij asfaltbekleding, 16 = Grasbekleding afschuiven binnentalud, 17 = Sterkte en stabiliteit langsconstructires, 18 = Technische innovaties
+ 'IsRelevant' TINYINT (1) NOT NULL, -- true or false
+ 'InputComments' TEXT,
+ 'OutputComments' TEXT,
+ 'NotRelevantComments' TEXT,
+ CONSTRAINT 'FK_FailureMechanismEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'FK_FailureMechanismEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'UI_AssessmentSectionEntityId_FailureMechanismType' UNIQUE ('AssessmentSectionEntityId','FailureMechanismType')
+)
+;
+
+CREATE TABLE 'FailureMechanismSectionEntity'
+(
+ 'FailureMechanismSectionEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'Name' VARCHAR (260) NOT NULL,
+ 'FailureMechanismSectionPointXml' TEXT NOT NULL,
+ CONSTRAINT 'FK_FailureMechanismSectionEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'PipingFailureMechanismMetaEntity'
+(
+ 'PipingFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'A' REAL NOT NULL,
+ 'WaterVolumetricWeight' REAL NOT NULL,
+ 'StochasticSoilModelSourcePath' TEXT,
+ 'SurfaceLineSourcePath' TEXT,
+ CONSTRAINT 'FK_PipingFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'StabilityPointStructuresFailureMechanismMetaEntity'
+(
+ 'StrengthStabilityPointConstructionFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'N' INT (4) NOT NULL,
+ CONSTRAINT 'FK_StrengthStabilityPointConstructionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'ClosingStructuresFailureMechanismMetaEntity'
+(
+ 'ClosingStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'N2A' INT (4) NOT NULL,
+ CONSTRAINT 'FK_ClosingStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'DuneErosionFailureMechanismMetaEntity'
+(
+ 'DuneErosionFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'N' REAL NOT NULL,
+ CONSTRAINT 'FK_DuneErosionFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'CalculationGroupEntity'
+(
+ 'CalculationGroupEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'ParentCalculationGroupEntityId' INTEGER,
+ 'Name' VARCHAR (260),
+ 'Order' INT (4) NOT NULL,
+ CONSTRAINT 'FK_CalculationGroupEntity_CalculationGroupEntity' FOREIGN KEY ('ParentCalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'HeightStructuresFailureMechanismMetaEntity'
+(
+ 'HeightStructuresFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'N' INT (4) NOT NULL,
+ CONSTRAINT 'FK_HeightStructuresFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'HydraulicLocationEntity'
+(
+ 'HydraulicLocationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'AssessmentSectionEntityId' INTEGER NOT NULL,
+ 'LocationId' INTEGER NOT NULL,
+ 'Name' VARCHAR (260) NOT NULL,
+ 'LocationX' REAL,
+ 'LocationY' REAL,
+ 'Order' INT (4) NOT NULL,
+ CONSTRAINT 'FK_HydraulicLocationEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'PipingCalculationEntity'
+(
+ 'PipingCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'CalculationGroupEntityId' INTEGER NOT NULL,
+ 'SurfaceLineEntityId' INTEGER,
+ 'StochasticSoilProfileEntityId' INTEGER,
+ 'HydraulicLocationEntityId' INTEGER,
+ 'Order' INT (4) NOT NULL,
+ 'Name' VARCHAR (260),
+ 'Comments' TEXT,
+ 'EntryPointL' REAL,
+ 'ExitPointL' REAL,
+ 'PhreaticLevelExitMean' REAL,
+ 'PhreaticLevelExitStandardDeviation' REAL,
+ 'DampingFactorExitMean' REAL,
+ 'DampingFactorExitStandardDeviation' REAL,
+ 'RelevantForScenario' TINYINT (1) NOT NULL, -- true or false
+ 'ScenarioContribution' REAL,
+ 'AssessmentLevel' REAL,
+ 'UseAssessmentLevelManualInput' TINYINT (1) NOT NULL, -- true or false
+ CONSTRAINT 'FK_PipingCalculationEntity_CalculationGroupEntity' FOREIGN KEY ('CalculationGroupEntityId') REFERENCES 'CalculationGroupEntity' ('CalculationGroupEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'FK_PipingCalculationEntity_HydraulicLocationEntity' FOREIGN KEY ('HydraulicLocationEntityId') REFERENCES 'HydraulicLocationEntity' ('HydraulicLocationEntityId') ON DELETE Set Null ON UPDATE Cascade,
+ CONSTRAINT 'FK_PipingCalculationEntity_StochasticSoilProfileEntity' FOREIGN KEY ('StochasticSoilProfileEntityId') REFERENCES 'StochasticSoilProfileEntity' ('StochasticSoilProfileEntityId') ON DELETE Set Null ON UPDATE Cascade,
+ CONSTRAINT 'FK_PipingCalculationEntity_SurfaceLineEntity' FOREIGN KEY ('SurfaceLineEntityId') REFERENCES 'SurfaceLineEntity' ('SurfaceLineEntityId') ON DELETE Set Null ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'GrassCoverErosionInwardsFailureMechanismMetaEntity'
+(
+ 'GrassCoverErosionInwardsFailureMechanismMetaEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'N' INT (4) NOT NULL,
+ CONSTRAINT 'FK_GrassCoverErosionInwardsFailureMechanismMetaEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'GrassCoverErosionInwardsCalculationEntity'
+(
+ 'GrassCoverErosionInwardsCalculationEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'CalculationGroupEntityId' INTEGER NOT NULL,
+ 'HydraulicLocationEntityId' INTEGER,
+ 'DikeProfileEntityId' INTEGER,
+ 'Order' INT (4) NOT NULL,
+ 'Name' VARCHAR (260),
+ 'Comments' TEXT,
+ 'Orientation' REAL,
+ 'CriticalFlowRateMean' REAL,
+ 'CriticalFlowRateStandardDeviation' REAL,
+ 'UseForeshore' TINYINT (1) NOT NULL, -- true or false
+ 'DikeHeightCalculationType' TINYINT (1) NOT NULL, -- Enum: 1 = NoCalculation, 2 = CalculateByAssessmentSectionNorm, 3 = CalculateByProfileSpecificRequiredProbability
+ 'DikeHeight' REAL,
+ 'UseBreakWater' TINYINT (1) NOT NULL, -- true or false
+ 'BreakWaterType' TINYINT (1) NOT NULL, -- Enum: 1 = Wall, 2 = Caisson, 3 = Dam
+ 'BreakWaterHeight' REAL,
+ 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 NOT NULL,
+ 'Order' INT (4) NOT NULL,
+ CONSTRAINT 'FK_StochasticSoilProfileEntity_SoilProfileEntity' FOREIGN KEY ('SoilProfileEntityId') REFERENCES 'SoilProfileEntity' ('SoilProfileEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'FK_StochasticSoilProfileEntity_StochasticSoilModelEntity' FOREIGN KEY ('StochasticSoilModelEntityId') REFERENCES 'StochasticSoilModelEntity' ('StochasticSoilModelEntityId') ON DELETE Cascade ON UPDATE Cascade
+)
+;
+
+CREATE TABLE 'StochasticSoilModelEntity'
+(
+ 'StochasticSoilModelEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'FailureMechanismEntityId' INTEGER NOT NULL,
+ 'Name' TEXT NOT NULL,
+ 'SegmentName' TEXT,
+ 'StochasticSoilModelSegmentPointXml' TEXT NOT NULL,
+ 'Order' INT (4) NOT NULL,
+ CONSTRAINT 'FK_StochasticSoilModelEntity_FailureMechanismEntity' FOREIGN KEY ('FailureMechanismEntityId') REFERENCES 'FailureMechanismEntity' ('FailureMechanismEntityId') ON DELETE Cascade ON UPDATE Cascade,
+ CONSTRAINT 'UQ_StochasticSoilModelEntity_Name' UNIQUE ('Name')
+)
+;
+
+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 TABLE 'BackgroundMapDataEntity'
+(
+ 'BackgroundMapDataEntityId' INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+ 'AssessmentSectionEntityId' INTEGER NOT NULL,
+ 'Name' TEXT NOT NULL,
+ 'SourceCapabilitiesUrl' TEXT,
+ 'SelectedCapabilityName' TEXT,
+ 'PreferredFormat' VARCHAR (255),
+ 'IsVisible' TINYINT (1) NOT NULL, -- true or false
+ 'Transparency' REAL NOT NULL,
+ CONSTRAINT 'FK_WmtsMapDataEntity_AssessmentSectionEntity' FOREIGN KEY ('AssessmentSectionEntityId') REFERENCES 'AssessmentSectionEntity' ('AssessmentSectionEntityId') 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)
+;
+
+CREATE INDEX 'IXFK_WmtsMapDataEntity_AssessmentSectionEntity'
+ ON 'BackgroundMapDataEntity' ('AssessmentSectionEntityId' ASC)
+;
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/Resources/Migration_5_17.1.sql (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,157 @@
+/*
+Migration script for migrating Ringtoets databases.
+SourceProject version: 5
+TargetProject version: 17.1
+*/
+PRAGMA foreign_keys = OFF;
+
+ATTACH DATABASE [{0}] AS SOURCEPROJECT;
+
+INSERT INTO AssessmentSectionEntity SELECT * FROM [SOURCEPROJECT].AssessmentSectionEntity;
+INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity;
+INSERT INTO CharacteristicPointEntity SELECT * FROM [SOURCEPROJECT].CharacteristicPointEntity;
+INSERT INTO ClosingStructureEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureEntity;
+INSERT INTO ClosingStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureFailureMechanismMetaEntity;
+INSERT INTO ClosingStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresCalculationEntity;
+INSERT INTO ClosingStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresOutputEntity;
+INSERT INTO ClosingStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresSectionResultEntity;
+INSERT INTO DikeProfileEntity SELECT * FROM [SOURCEPROJECT].DikeProfileEntity;
+INSERT INTO DuneErosionSectionResultEntity SELECT * FROM [SOURCEPROJECT].DuneErosionSectionResultEntity;
+INSERT INTO FailureMechanismEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismEntity;
+INSERT INTO FailureMechanismSectionEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismSectionEntity;
+INSERT INTO ForeshoreProfileEntity SELECT * FROM [SOURCEPROJECT].ForeshoreProfileEntity;
+INSERT INTO GrassCoverErosionInwardsCalculationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsCalculationEntity;
+INSERT INTO GrassCoverErosionInwardsDikeHeightOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsDikeHeightOutputEntity;
+INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity;
+INSERT INTO GrassCoverErosionInwardsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsOutputEntity;
+INSERT INTO GrassCoverErosionInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsSectionResultEntity;
+INSERT INTO GrassCoverErosionOutwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsFailureMechanismMetaEntity;
+INSERT INTO GrassCoverErosionOutwardsHydraulicLocationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsHydraulicLocationEntity;
+INSERT INTO GrassCoverErosionOutwardsHydraulicLocationOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsHydraulicLocationOutputEntity;
+INSERT INTO GrassCoverErosionOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsSectionResultEntity;
+INSERT INTO GrassCoverErosionOutwardsWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsCalculationEntity;
+INSERT INTO GrassCoverErosionOutwardsWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsOutputEntity;
+INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity;
+INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity;
+INSERT INTO HeightStructureEntity SELECT * FROM [SOURCEPROJECT].HeightStructureEntity;
+INSERT INTO HeightStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresCalculationEntity;
+INSERT INTO HeightStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresFailureMechanismMetaEntity;
+INSERT INTO HeightStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresOutputEntity;
+INSERT INTO HeightStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresSectionResultEntity;
+INSERT INTO HydraulicLocationEntity SELECT * FROM [SOURCEPROJECT].HydraulicLocationEntity;
+INSERT INTO HydraulicLocationOutputEntity SELECT * FROM [SOURCEPROJECT].HydraulicLocationOutputEntity;
+INSERT INTO MacrostabilityInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].MacrostabilityInwardsSectionResultEntity;
+INSERT INTO MacrostabilityOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].MacrostabilityOutwardsSectionResultEntity;
+INSERT INTO MicrostabilitySectionResultEntity SELECT * FROM [SOURCEPROJECT].MicrostabilitySectionResultEntity;
+INSERT INTO PipingCalculationEntity SELECT * FROM [SOURCEPROJECT].PipingCalculationEntity;
+INSERT INTO PipingCalculationOutputEntity SELECT * FROM [SOURCEPROJECT].PipingCalculationOutputEntity;
+ INSERT INTO PipingFailureMechanismMetaEntity (
+ [PipingFailureMechanismMetaEntityId],
+ [FailureMechanismEntityId],
+ [A],
+ [WaterVolumetricWeight],
+ [StochasticSoilModelSourcePath],
+ [SurfacelineSourcePath])
+SELECT
+ [PipingFailureMechanismMetaEntityId],
+ [FailureMechanismEntityId],
+ [A],
+ [WaterVolumetricWeight],
+ "Onbekend",
+ "Onbekend" FROM [SOURCEPROJECT].PipingFailureMechanismMetaEntity;
+INSERT INTO PipingSectionResultEntity SELECT * FROM [SOURCEPROJECT].PipingSectionResultEntity;
+INSERT INTO PipingSemiProbabilisticOutputEntity SELECT * FROM [SOURCEPROJECT].PipingSemiProbabilisticOutputEntity;
+INSERT INTO PipingStructureSectionResultEntity SELECT * FROM [SOURCEPROJECT].PipingStructureSectionResultEntity;
+INSERT INTO ProjectEntity SELECT * FROM [SOURCEPROJECT].ProjectEntity;
+INSERT INTO SoilLayerEntity SELECT * FROM [SOURCEPROJECT].SoilLayerEntity;
+INSERT INTO SoilProfileEntity SELECT * FROM [SOURCEPROJECT].SoilProfileEntity;
+INSERT INTO StabilityPointStructureEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructureEntity;
+INSERT INTO StabilityPointStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresCalculationEntity;
+INSERT INTO StabilityPointStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresFailureMechanismMetaEntity;
+INSERT INTO StabilityPointStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresOutputEntity;
+INSERT INTO StabilityPointStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresSectionResultEntity;
+INSERT INTO StabilityStoneCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverSectionResultEntity;
+INSERT INTO StabilityStoneCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity;
+INSERT INTO StabilityStoneCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsOutputEntity;
+INSERT INTO StochasticSoilModelEntity
+SELECT
+ [StochasticSoilModelEntityId],
+ [FailuremechanismEntityId],
+ CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
+ [SegmentName],
+ [StochasticSoilModelSegmentPointXml],
+ [Order]
+ FROM (SELECT *, (SELECT count(*)
+ FROM [SOURCEPROJECT].StochasticSoilModelEntity
+ WHERE SSM.StochasticSoilModelEntityId > StochasticSoilModelEntityId
+ AND SSM.Name IS Name) as Suffix
+ FROM [SOURCEPROJECT].StochasticSoilModelEntity SSM);
+INSERT INTO StochasticSoilProfileEntity
+SELECT
+ [StochasticSoilProfileEntityId],
+ [SoilProfileEntityId],
+ [StochasticSoilmodelEntityId],
+ CASE
+ WHEN [Probability] BETWEEN 0 AND 1 THEN [Probability]
+ ELSE 0
+ END as [Probability],
+ [Order]
+FROM [SOURCEPROJECT].StochasticSoilProfileEntity;
+INSERT INTO StrengthStabilityLengthwiseConstructionSectionResultEntity SELECT * FROM [SOURCEPROJECT].StrengthStabilityLengthwiseConstructionSectionResultEntity;
+INSERT INTO SurfaceLineEntity
+SELECT
+ [SurfaceLineEntityId],
+ [FailuremechanismEntityId],
+ CASE WHEN Suffix THEN [Name] || '(' || Suffix || ')' ELSE [Name] END as [Name],
+ [ReferenceLineIntersectionX],
+ [ReferenceLineIntersectionY],
+ [PointsXml],
+ [Order]
+ FROM (SELECT *, (SELECT count(*)
+ FROM [SOURCEPROJECT].SurfaceLineEntity
+ WHERE SL.SurfaceLineEntityId > SurfaceLineEntityId
+ AND SL.Name IS Name) as Suffix
+ FROM [SOURCEPROJECT].SurfaceLineEntity SL);
+INSERT INTO TechnicalInnovationSectionResultEntity SELECT * FROM [SOURCEPROJECT].TechnicalInnovationSectionResultEntity;
+INSERT INTO VersionEntity (
+ [VersionId],
+ [Version],
+ [Timestamp],
+ [FingerPrint])
+SELECT [VersionId],
+ "17.1",
+ [Timestamp],
+ [FingerPrint]
+ FROM [SOURCEPROJECT].VersionEntity;
+INSERT INTO WaterPressureAsphaltCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].WaterPressureAsphaltCoverSectionResultEntity;
+INSERT INTO WaveImpactAsphaltCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverSectionResultEntity;
+INSERT INTO WaveImpactAsphaltCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsCalculationEntity;
+INSERT INTO WaveImpactAsphaltCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsOutputEntity;
+
+/*
+Remove Outputs
+*/
+
+
+/*
+Insert new data
+*/
+INSERT INTO DuneErosionFailureMechanismMetaEntity (
+ [FailureMechanismEntityId],
+ [N])
+SELECT FailureMechanismEntityId,
+ 2.0
+ FROM FailureMechanismEntity WHERE FailureMechanismType = 8;
+INSERT INTO BackgroundMapDataEntity (
+ [AssessmentSectionEntityId],
+ [Name],
+ [IsVisible],
+ [Transparency])
+SELECT AssessmentSectionEntityId,
+ "",
+ 0,
+ 0.0
+ FROM AssessmentSectionEntity;
+
+DETACH SOURCEPROJECT;
+PRAGMA foreign_keys = ON;
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsCreateScript.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsCreateScript.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsCreateScript.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,77 @@
+// 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.Data.SQLite;
+using Application.Ringtoets.Migration.Core.Properties;
+using Migration.Scripts.Data;
+using Migration.Scripts.Data.Exceptions;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that provides methods for creating a for a specific version.
+ ///
+ public class RingtoetsCreateScript : CreateScript
+ {
+ private readonly string createQuery;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The version was designed for.
+ /// The SQL query that belongs to .
+ /// Thrown when:
+ ///
+ /// is not a valid Ringtoets database version,
+ /// is empty, null, or consist out of only whitespace characters.
+ ///
+ public RingtoetsCreateScript(string version, string query) : base(version)
+ {
+ RingtoetsVersionHelper.ValidateVersion(version);
+
+ if (string.IsNullOrWhiteSpace(query))
+ {
+ throw new ArgumentException(@"Query must have a value.", nameof(query));
+ }
+ createQuery = query;
+ }
+
+ protected override IVersionedFile GetEmptyVersionedFile(string location)
+ {
+ try
+ {
+ using (var databaseFile = new RingtoetsDatabaseFile(location))
+ {
+ databaseFile.OpenDatabaseConnection();
+ databaseFile.ExecuteQuery(createQuery);
+ }
+ return new RingtoetsVersionedFile(location);
+ }
+ catch (SQLiteException exception)
+ {
+ throw new CriticalMigrationException(string.Format(Resources.RingtoetsCreateScript_Creating_Version_0_Failed,
+ GetVersion()), exception);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseFile.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseFile.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseFile.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,109 @@
+// 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.Data.SQLite;
+using Core.Common.IO;
+using Core.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that provides methods for the migration of a Ringtoets database target file.
+ ///
+ public class RingtoetsDatabaseFile : IDisposable
+ {
+ private readonly string filePath;
+ private SQLiteConnection connection;
+ private bool disposed;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The path to the target file.
+ /// Thrown when :
+ ///
+ /// is not empty or null,
+ /// does not consist out of only whitespace characters,
+ /// does not contain an invalid character,
+ /// does not end with a directory or path separator (empty file name),
+ /// is not writable.
+ ///
+ /// Creates the file if it does not exist.
+ public RingtoetsDatabaseFile(string path)
+ {
+ IOUtils.CreateFileIfNotExists(path);
+ filePath = path;
+ }
+
+ ///
+ /// Opens the connection to the Ringtoets database file.
+ ///
+ public void OpenDatabaseConnection()
+ {
+ connection = new SQLiteConnection(SqLiteConnectionStringBuilder.BuildSqLiteConnectionString(filePath, false));
+ connection.Open();
+ }
+
+ ///
+ /// Executes the on the Ringtoets database file.
+ ///
+ /// Create structure query to execute.
+ /// Thrown when is null
+ /// or consist out of only whitespace characters.
+ /// Thrown when executing failed.
+ public void ExecuteQuery(string query)
+ {
+ if (string.IsNullOrWhiteSpace(query))
+ {
+ throw new ArgumentException(@"Parameter must be a valid database script.", nameof(query));
+ }
+ using (var command = new SQLiteCommand(connection)
+ {
+ CommandText = query
+ })
+ {
+ command.ExecuteNonQuery();
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ private void Dispose(bool disposing)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (disposing)
+ {
+ connection?.Dispose();
+ connection = null;
+ }
+ disposed = true;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseQueryBuilder.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseQueryBuilder.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseQueryBuilder.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,41 @@
+// 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.
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Defines queries to execute on a Ringtoets database.
+ ///
+ public static class RingtoetsDatabaseQueryBuilder
+ {
+ ///
+ /// Returns the query to get the version from the Ringtoets database.
+ ///
+ /// The query to get the version from the Ringtoets database.
+ public static string GetVersionQuery()
+ {
+ return $"SELECT {VersionTableDefinitions.Version} "
+ + $"FROM {VersionTableDefinitions.TableName} "
+ + $"Order by {VersionTableDefinitions.Timestamp} DESC "
+ + "LIMIT 1";
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseSourceFile.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseSourceFile.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsDatabaseSourceFile.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,77 @@
+// 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.Data;
+using Application.Ringtoets.Migration.Core.Properties;
+using Core.Common.Base.Storage;
+using Core.Common.IO.Exceptions;
+using Core.Common.IO.Readers;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that provides methods for the migration database source file.
+ ///
+ public class RingtoetsDatabaseSourceFile : SqLiteDatabaseReaderBase
+ {
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The path to the source file.
+ /// Thrown when:
+ ///
+ /// The contains invalid characters.
+ /// No file could be found at .
+ /// Unable to open database file.
+ ///
+ ///
+ public RingtoetsDatabaseSourceFile(string databaseFilePath) : base(databaseFilePath) {}
+
+ ///
+ /// Gets the version of the Ringtoets database source file at location .
+ ///
+ /// The version of the file.
+ /// Thrown when the file is not a valid
+ /// Ringtoets database source file.
+ public string GetVersion()
+ {
+ string versionQuery = RingtoetsDatabaseQueryBuilder.GetVersionQuery();
+ try
+ {
+ using (IDataReader dataReader = CreateDataReader(versionQuery, null))
+ {
+ if (!dataReader.Read())
+ {
+ return string.Empty;
+ }
+
+ return dataReader.Read(VersionTableDefinitions.Version);
+ }
+ }
+ catch (SystemException exception)
+ {
+ throw new StorageValidationException(string.Format(Resources.RingtoetsDatabaseSourceFile_Invalid_Ringtoets_File_Path_0,
+ Path), exception);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsMigrator.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsMigrator.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsMigrator.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,63 @@
+// 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 Migration.Core.Storage;
+
+namespace Application.Ringtoets.Migration
+{
+ ///
+ /// Class responsible for migrating a Ringtoets project in the application.
+ ///
+ public class RingtoetsMigrator
+ {
+ private VersionedFileMigrator migrator;
+
+ ///
+ /// Instantiates a .
+ ///
+ ///
+ public RingtoetsMigrator(VersionedFileMigrator migrator)
+ {
+ if (migrator == null)
+ {
+ throw new ArgumentNullException(nameof(migrator));
+ }
+
+ this.migrator = migrator;
+ }
+
+ public bool Migrate(string sourcePath, string targetPath)
+ {
+ throw new NotImplementedException();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool ShouldMigrate(string sourcePath)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsSqLiteDatabaseFileMigrator.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsSqLiteDatabaseFileMigrator.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsSqLiteDatabaseFileMigrator.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,114 @@
+// 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.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text.RegularExpressions;
+using Application.Ringtoets.Migration.Core.Properties;
+using Migration.Core.Storage;
+using Migration.Scripts.Data;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that provides methods for migrating a .
+ ///
+ public class RingtoetsSqLiteDatabaseFileMigrator : VersionedFileMigrator
+ {
+ private readonly Assembly scriptResource;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ public RingtoetsSqLiteDatabaseFileMigrator() : base(new RingtoetsVersionComparer())
+ {
+ scriptResource = typeof(Resources).Assembly;
+ }
+
+ private static string GetStringOfStream(Stream stream)
+ {
+ using (var reader = new StreamReader(stream))
+ {
+ return reader.ReadToEnd();
+ }
+ }
+
+ #region UpgradeScript
+
+ protected override IEnumerable GetAvailableUpgradeScripts()
+ {
+ return scriptResource.GetManifestResourceNames().Where(r => r.Contains("Migration_"))
+ .Select(CreateNewUpgradeScript);
+ }
+
+ private static string GetMigrationScriptFromVersion(string filename)
+ {
+ Match match = Regex.Match(filename, @"(Migration_)(.*)(_.*\.sql)$", RegexOptions.IgnoreCase);
+ return match.Success ? match.Groups[2].Value : null;
+ }
+
+ private static string GetMigrationScriptToVersion(string filename)
+ {
+ Match match = Regex.Match(filename, @"(Migration_.*_)(.*)(\.sql)$", RegexOptions.IgnoreCase);
+ return match.Success ? match.Groups[2].Value : null;
+ }
+
+ private UpgradeScript CreateNewUpgradeScript(string resourceName)
+ {
+ string fromVersion = GetMigrationScriptFromVersion(resourceName);
+ string toVersion = GetMigrationScriptToVersion(resourceName);
+ Stream upgradeStream = scriptResource.GetManifestResourceStream(resourceName);
+
+ var upgradeQuery = GetStringOfStream(upgradeStream);
+
+ return new RingtoetsUpgradeScript(fromVersion, toVersion, upgradeQuery);
+ }
+
+ #endregion
+
+ #region CreateScript
+
+ protected override IEnumerable GetAvailableCreateScripts()
+ {
+ return scriptResource.GetManifestResourceNames().Where(r => r.Contains("DatabaseStructure"))
+ .Select(CreateNewCreateScript);
+ }
+
+ private static string GetCreateScriptVersion(string filename)
+ {
+ Match match = Regex.Match(filename, @"(DatabaseStructure)(.*)(\.sql)$", RegexOptions.IgnoreCase);
+ return match.Success ? match.Groups[2].Value : null;
+ }
+
+ private RingtoetsCreateScript CreateNewCreateScript(string resourceName)
+ {
+ string version = GetCreateScriptVersion(resourceName);
+ Stream createStream = scriptResource.GetManifestResourceStream(resourceName);
+ string query = GetStringOfStream(createStream);
+ return new RingtoetsCreateScript(version, query);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsUpgradeScript.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsUpgradeScript.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsUpgradeScript.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,82 @@
+// 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.Data.SQLite;
+using Application.Ringtoets.Migration.Core.Properties;
+using Migration.Scripts.Data;
+using Migration.Scripts.Data.Exceptions;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that provides methods for the upgrading a for a specific version.
+ ///
+ public class RingtoetsUpgradeScript : UpgradeScript
+ {
+ private readonly string upgradeQuery;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The source version was designed for.
+ /// The target version was designed for.
+ /// The SQL query to upgrade from to .
+ /// Thrown when:
+ ///
+ /// is not a valid Ringtoets database version,
+ /// is not a valid Ringtoets database version,
+ /// is empty, null, or consists out of only whitespace characters.
+ ///
+ public RingtoetsUpgradeScript(string fromVersion, string toVersion, string query)
+ : base(fromVersion, toVersion)
+ {
+ if (string.IsNullOrWhiteSpace(query))
+ {
+ throw new ArgumentException(@"Query must have a value.", nameof(query));
+ }
+
+ RingtoetsVersionHelper.ValidateVersion(fromVersion);
+ RingtoetsVersionHelper.ValidateVersion(toVersion);
+
+ upgradeQuery = query;
+ }
+
+ protected override void PerformUpgrade(string sourceLocation, string targetLocation)
+ {
+ try
+ {
+ var query = string.Format(upgradeQuery, sourceLocation);
+ using (var databaseFile = new RingtoetsDatabaseFile(targetLocation))
+ {
+ databaseFile.OpenDatabaseConnection();
+ databaseFile.ExecuteQuery(query);
+ }
+ }
+ catch (SQLiteException exception)
+ {
+ throw new CriticalMigrationException(string.Format(Resources.RingtoetsUpgradeScript_Upgrading_Version_0_To_Version_1_Failed,
+ FromVersion(), ToVersion()), exception);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsVersionedFile.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsVersionedFile.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/RingtoetsVersionedFile.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,61 @@
+// 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 Core.Common.Utils;
+using Migration.Scripts.Data;
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Class that defines a Ringtoets database file that has a version.
+ ///
+ public class RingtoetsVersionedFile : IVersionedFile
+ {
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// Path to the Ringtoets versioned file.
+ /// Thrown when is invalid.
+ /// A valid path:
+ ///
+ /// is not empty or null,
+ /// does not consist out of only whitespace characters,
+ /// does not contain an invalid character,
+ /// does not end with a directory or path separator (empty file name).
+ ///
+ public RingtoetsVersionedFile(string path)
+ {
+ IOUtils.ValidateFilePath(path);
+ Location = path;
+ }
+
+ public string Location { get; }
+
+ public string GetVersion()
+ {
+ using (var sourceFile = new RingtoetsDatabaseSourceFile(Location))
+ {
+ return sourceFile.GetVersion();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/VersionTableDefinitions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/VersionTableDefinitions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/VersionTableDefinitions.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,44 @@
+// 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.
+
+namespace Application.Ringtoets.Migration.Core
+{
+ ///
+ /// Defines the table and column names of the table 'VersionEntity' in the Ringtoets database.
+ ///
+ public static class VersionTableDefinitions
+ {
+ ///
+ /// Gets the name of the table.
+ ///
+ public const string TableName = "VersionEntity";
+
+ ///
+ /// Gets the name of the version column.
+ ///
+ public const string Version = "Version";
+
+ ///
+ /// Gets the name of the timestamp column.
+ ///
+ public const string Timestamp = "Timestamp";
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration.Core/packages.config
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Migration.Core/packages.config (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration.Core/packages.config (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj
===================================================================
diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r9d68a734d8da9bfadd3bdd349ddb56fb70d461ec
--- Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd)
+++ Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -2,7 +2,9 @@
- {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
+ Debug
+ x86
+ {AC4F7F48-F674-4E32-AB35-9C726605F684}LibraryPropertiesApplication.Ringtoets.Migration
@@ -34,89 +36,16 @@
-
-
- ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
- True
-
-
- Properties\GlobalAssembly.cs
-
-
- True
- True
- Resources.resx
-
-
-
-
-
-
-
-
-
Copying.licenseheader
-
-
-
- {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
- Core.Common.Base
- False
-
-
- {e344867e-9ac9-44c8-88a5-8185681679a9}
- Core.Common.IO
- False
-
-
- {f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
- Core.Common.Utils
- False
-
-
- {EFD7E662-5B69-4B71-A448-565B64E9C033}
- Migration.Core.Storage
- False
-
-
- {D08DB9E2-6861-44C8-A725-71A70274CC77}
- Migration.Scripts.Data
- False
-
-
- {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
- Ringtoets.Common.Utils
- False
-
-
-
-
- PublicResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
+
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/Properties/AssemblyInfo.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/Properties/AssemblyInfo.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,27 @@
+// 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.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Application.Ringtoets.Migration.Console.Test")]
+[assembly: AssemblyProduct("Application.Ringtoets.Migration.Console.Test")]
+[assembly: Guid("1d3c098b-1eed-488c-900d-b71155c2d6ab")]
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationConsoleTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationConsoleTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationConsoleTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,253 @@
+// 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 Application.Ringtoets.Migration.Core;
+using Core.Common.TestUtil;
+using Migration.Console;
+using Migration.Console.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Console.Test
+{
+ [TestFixture]
+ public class RingtoetsMigrationConsoleTest
+ {
+ private TestEnvironmentControl environmentControl;
+
+ [SetUp]
+ public void SetUp()
+ {
+ environmentControl = new TestEnvironmentControl();
+ EnvironmentControl.Instance = environmentControl;
+ }
+
+ [Test]
+ public void Constructor_ExpectedProperties()
+ {
+ // Call
+ var console = new RingtoetsMigrationConsole();
+
+ // Assert
+ Assert.IsInstanceOf(console);
+ }
+
+ [Test]
+ public void ExecuteConsoleTool_NoArguments_WritesHelpToConsole()
+ {
+ // Setup
+ var console = new RingtoetsMigrationConsole();
+
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // Call
+ console.ExecuteConsoleTool(new string[]
+ {});
+
+ // Assert
+ string expectedText = Environment.NewLine + GetConsoleFullDescription();
+ string consoleText = consoleOutput.GetConsoleOutput();
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ public void ExecuteConsoleTool_InvalidArguments_WritesHelpToConsoleWithErrorCode()
+ {
+ // Setup
+ var console = new RingtoetsMigrationConsole();
+ string[] invalidCommand =
+ {
+ "0",
+ "1",
+ "2"
+ };
+
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // Call
+ console.ExecuteConsoleTool(invalidCommand);
+
+ // Assert
+ string expectedText = Environment.NewLine
+ + $"{string.Join(" ", invalidCommand)} is geen geldige opdracht."
+ + Environment.NewLine + Environment.NewLine
+ + GetConsoleFullDescription();
+ string consoleText = consoleOutput.GetConsoleOutput();
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ public void ExecuteConsoleTool_InvalidArgumentsForMigrate_WritesHelpToConsoleWithErrorCode()
+ {
+ // Setup
+ var console = new RingtoetsMigrationConsole();
+ string[] invalidCommand =
+ {
+ "",
+ ""
+ };
+
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // Call
+ console.ExecuteConsoleTool(invalidCommand);
+
+ // Assert
+ string expectedText = Environment.NewLine
+ + "Bron- en doelprojectpad moeten geldige bestandspaden zijn."
+ + Environment.NewLine + Environment.NewLine
+ + GetConsoleFullDescription();
+ string consoleText = consoleOutput.GetConsoleOutput();
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorInvalidCommandLine, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ [TestCase("FullTestProject164.rtd", "5", true)]
+ [TestCase("UnsupportedVersion8.rtd", "8", false)]
+ public void GivenConsole_WhenVersionSupportedCall_ThenReturnedIfSupported(string file, string fileVersion, bool isSupported)
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file);
+ var console = new RingtoetsMigrationConsole();
+ string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // When
+ console.ExecuteConsoleTool(new[]
+ {
+ sourceFilePath
+ });
+
+ // Then
+ string consoleText = consoleOutput.GetConsoleOutput();
+ string expectedText = isSupported
+ ? Environment.NewLine
+ + $@"Het projectbestand kan gemigreerd worden naar versie '{expectedVersion}'."
+ + Environment.NewLine
+ : Environment.NewLine
+ + $"Het migreren van een projectbestand met versie '{fileVersion}' naar versie '{expectedVersion}' is niet ondersteund."
+ + Environment.NewLine;
+
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ public void GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion()
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationConsoleTest)}.{nameof(GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion)}");
+ var console = new RingtoetsMigrationConsole();
+ string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ using (new FileDisposeHelper(targetFilePath))
+ {
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // When
+ console.ExecuteConsoleTool(new[]
+ {
+ sourceFilePath,
+ targetFilePath
+ });
+
+ // Then
+ string expected = Environment.NewLine
+ + $"Het projectbestand '{sourceFilePath}' is succesvol gemigreerd naar '{targetFilePath}' (versie {expectedVersion})."
+ + Environment.NewLine;
+ string consoleText = consoleOutput.GetConsoleOutput();
+ Assert.AreEqual(expected, consoleText);
+
+ var toVersionedFile = new RingtoetsVersionedFile(targetFilePath);
+ Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion());
+ }
+ }
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+
+ [Test]
+ public void GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode()
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationConsoleTest)}.{nameof(GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode)}");
+
+ var console = new RingtoetsMigrationConsole();
+
+ using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath))
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ fileDisposeHelper.LockFiles();
+
+ // When
+ console.ExecuteConsoleTool(new[]
+ {
+ sourceFilePath,
+ targetFilePath
+ });
+
+ // Then
+ string consoleText = consoleOutput.GetConsoleOutput();
+ StringAssert.StartsWith(Environment.NewLine + "Het gemigreerde projectbestand is aangemaakt op '",
+ consoleText);
+ StringAssert.EndsWith($"', maar er is een onverwachte fout opgetreden tijdens het verplaatsen naar '{targetFilePath}'."
+ + Environment.NewLine
+ + "Het besturingssysteem geeft de volgende melding: "
+ + Environment.NewLine
+ + $"The process cannot access the file '{targetFilePath}' because it is being used by another process."
+ + Environment.NewLine + Environment.NewLine
+ + GetConsoleFullDescription(), consoleText);
+ Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ private static string GetConsoleFullDescription()
+ {
+ string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ return "Dit hulpprogramma kan worden gebruikt om een projectbestand in het formaat van een "
+ + $"eerdere versie van Ringtoets te migreren naar het formaat van de huidige versie van Ringtoets ({currentDatabaseVersion})."
+ + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA -h" + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA --help" + Environment.NewLine
+ + " Geeft deze informatie weer." + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA bronprojectpad" + Environment.NewLine
+ + " Controleert of het projectbestand dat te vinden is in het bronproject"
+ + Environment.NewLine
+ + " pad gemigreerd kan worden." + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA bronprojectpad doelprojectpad" + Environment.NewLine
+ + " Voert de migratie uit van het projectbestand dat te vinden is in het "
+ + Environment.NewLine
+ + " bronprojectpad en slaat het resulterende projectbestand op in het doe"
+ + Environment.NewLine
+ + " lprojectpad." + Environment.NewLine + Environment.NewLine;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationToolTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationToolTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/RingtoetsMigrationToolTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,212 @@
+// 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 Application.Ringtoets.Migration.Core;
+using Core.Common.TestUtil;
+using Migration.Console;
+using Migration.Console.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Console.Test
+{
+ [TestFixture]
+ public class RingtoetsMigrationToolTest
+ {
+ private TestEnvironmentControl environmentControl;
+ private readonly TestDataPath testPath = TestDataPath.Application.Ringtoets.Migration;
+
+ [SetUp]
+ public void SetUp()
+ {
+ environmentControl = new TestEnvironmentControl();
+ EnvironmentControl.Instance = environmentControl;
+ }
+
+ [Test]
+ public void Main_NoArguments_WritesHelpToConsole()
+ {
+ // Setup
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // Call
+ RingtoetsMigrationTool.Main(new string[]
+ {});
+
+ // Assert
+ string consoleText = consoleOutput.GetConsoleOutput();
+ string expectedText = Environment.NewLine + GetConsoleFullDescription();
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ public void Main_InvalidArguments_WritesHelpToConsoleWithErrorCode()
+ {
+ // Setup
+ string[] invalidCommand =
+ {
+ "0",
+ "1",
+ "2"
+ };
+
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // Call
+ RingtoetsMigrationTool.Main(invalidCommand);
+
+ // Assert
+ string consoleText = consoleOutput.GetConsoleOutput();
+
+ string expectedText = Environment.NewLine
+ + $"{string.Join(" ", invalidCommand)} is geen geldige opdracht."
+ + Environment.NewLine + Environment.NewLine
+ + GetConsoleFullDescription();
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ [TestCase("FullTestProject164.rtd", "5", true)]
+ [TestCase("UnsupportedVersion8.rtd", "8", false)]
+ public void GivenConsole_WhenVersionSupportedCall_ThenReturnedIfSupported(string file, string fileVersion, bool isSupported)
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(testPath, file);
+ string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // When
+ RingtoetsMigrationTool.Main(new[]
+ {
+ sourceFilePath
+ });
+
+ // Then
+ string consoleText = consoleOutput.GetConsoleOutput();
+ string expectedText = isSupported
+ ? Environment.NewLine
+ + $@"Het projectbestand kan gemigreerd worden naar versie '{expectedVersion}'."
+ + Environment.NewLine
+ : Environment.NewLine
+ + $"Het migreren van een projectbestand met versie '{fileVersion}' naar versie '{expectedVersion}' is niet ondersteund."
+ + Environment.NewLine;
+
+ Assert.AreEqual(expectedText, consoleText);
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+ }
+
+ [Test]
+ public void GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion()
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd");
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationToolTest)}.{nameof(GivenConsole_WhenMigrateCalledWithArguments_MigratesToNewVersion)}");
+ string expectedVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ using (new FileDisposeHelper(targetFilePath))
+ {
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ // When
+ RingtoetsMigrationTool.Main(new[]
+ {
+ sourceFilePath,
+ targetFilePath
+ });
+
+ // Then
+ string consoleText = consoleOutput.GetConsoleOutput();
+ string expected = Environment.NewLine
+ + $"Het projectbestand '{sourceFilePath}' is succesvol gemigreerd naar "
+ + $"'{targetFilePath}' (versie {expectedVersion})."
+ + Environment.NewLine;
+ Assert.AreEqual(expected, consoleText);
+ var toVersionedFile = new RingtoetsVersionedFile(targetFilePath);
+ Assert.AreEqual(expectedVersion, toVersionedFile.GetVersion());
+ }
+ }
+ Assert.AreEqual(ErrorCode.ErrorSuccess, environmentControl.ErrorCodeCalled);
+ }
+
+ [Test]
+ public void GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode()
+ {
+ // Given
+ string sourceFilePath = TestHelper.GetTestDataPath(testPath, "FullTestProject164.rtd");
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(RingtoetsMigrationToolTest)}.{nameof(GivenConsole_WhenMigrateCalledUnableToSaveTarget_ThenExitWithErrorCode)}");
+
+ using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath))
+ using (var consoleOutput = new ConsoleOutput())
+ {
+ fileDisposeHelper.LockFiles();
+
+ // When
+ RingtoetsMigrationTool.Main(new[]
+ {
+ sourceFilePath,
+ targetFilePath
+ });
+
+ // Then
+ string consoleText = consoleOutput.GetConsoleOutput();
+ StringAssert.StartsWith(Environment.NewLine
+ + "Het gemigreerde projectbestand is aangemaakt op '",
+ consoleText);
+ StringAssert.EndsWith($"', maar er is een onverwachte fout opgetreden tijdens het verplaatsen naar '{targetFilePath}'."
+ + Environment.NewLine
+ + "Het besturingssysteem geeft de volgende melding: " + Environment.NewLine
+ + $"The process cannot access the file '{targetFilePath}' because it is being used by another process."
+ + Environment.NewLine + Environment.NewLine
+ + GetConsoleFullDescription(), consoleText);
+ }
+
+ Assert.AreEqual(ErrorCode.ErrorBadCommand, environmentControl.ErrorCodeCalled);
+ }
+
+ private static string GetConsoleFullDescription()
+ {
+ string currentDatabaseVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ return "Dit hulpprogramma kan worden gebruikt om een projectbestand in het formaat van een "
+ + $"eerdere versie van Ringtoets te migreren naar het formaat van de huidige versie van Ringtoets ({currentDatabaseVersion})."
+ + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA -h" + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA --help" + Environment.NewLine
+ + " Geeft deze informatie weer." + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA bronprojectpad" + Environment.NewLine
+ + " Controleert of het projectbestand dat te vinden is in het bronproject"
+ + Environment.NewLine
+ + " pad gemigreerd kan worden." + Environment.NewLine + Environment.NewLine
+ + "MIGRATIEHULPPROGRAMMA bronprojectpad doelprojectpad" + Environment.NewLine
+ + " Voert de migratie uit van het projectbestand dat te vinden is in het "
+ + Environment.NewLine
+ + " bronprojectpad en slaat het resulterende projectbestand op in het doe"
+ + Environment.NewLine
+ + " lprojectpad."
+ + Environment.NewLine + Environment.NewLine;
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/packages.config
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/packages.config (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Console.Test/packages.config (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Application.Ringtoets.Migration.Core.Test.csproj
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Application.Ringtoets.Migration.Core.Test.csproj (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Application.Ringtoets.Migration.Core.Test.csproj (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,118 @@
+
+
+
+ Debug
+ x86
+ {40CF9BC7-3CDE-4AC0-B31A-851694821772}
+ Library
+ Properties
+ Application.Ringtoets.Migration.Core.Test
+ Application.Ringtoets.Migration.Core.Test
+ v4.0
+ 512
+
+
+ true
+ bin\Debug\
+ 4
+ x86
+ TRACE;DEBUG
+ full
+
+
+ bin\Release\
+ 4
+ x86
+ TRACE
+ true
+ none
+
+
+ bin\ReleaseForCodeCoverage\
+ TRACE
+ true
+ x86
+ none
+
+
+
+ ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll
+ True
+
+
+ ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll
+ True
+
+
+
+
+
+ False
+ ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
+
+
+
+
+ Properties\GlobalAssembly.cs
+
+
+
+
+
+
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
+
+ {E344867E-9AC9-44C8-88A5-8185681679A9}
+ Core.Common.IO
+
+
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}
+ Core.Common.TestUtil
+
+
+ {efd7e662-5b69-4b71-a448-565b64e9c033}
+ Migration.Core.Storage
+
+
+ {d08db9e2-6861-44c8-a725-71a70274cc77}
+ Migration.Scripts.Data
+
+
+ {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
+ Ringtoets.Common.Utils
+
+
+ {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
+ Application.Ringtoets.Migration.Core
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Properties/AssemblyInfo.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/Properties/AssemblyInfo.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,27 @@
+// 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.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("Application.Ringtoets.Migration.Core.Test")]
+[assembly: AssemblyProduct("Application.Ringtoets.Migration.Core.Test")]
+[assembly: Guid("40cf9bc7-3cde-4ac0-b31a-851694821772")]
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsCreateScriptTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsCreateScriptTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsCreateScriptTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,168 @@
+// 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.Data.SQLite;
+using System.IO;
+using Core.Common.TestUtil;
+using Migration.Scripts.Data;
+using Migration.Scripts.Data.Exceptions;
+using NUnit.Framework;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsCreateScriptTest
+ {
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void Constructor_VersionNullOrEmpty_ThrowsArgumentException(string version)
+ {
+ // Setup
+ const string query = "Valid query";
+
+ // Call
+ TestDelegate call = () => new RingtoetsCreateScript(version, query);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("version", paramName);
+ }
+
+ [Test]
+ [TestCase("4")]
+ public void Constructor_InvalidVersion_ThrowsArgumentException(string version)
+ {
+ // Setup
+ const string query = "Valid query";
+
+ // Call
+ TestDelegate call = () => new RingtoetsCreateScript(version, query);
+
+ // Assert
+ string expectedMessage = $@"'{version}' is geen geldige Ringtoets versie.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void Constructor_InvalidQuery_ThrowsArgumentException(string query)
+ {
+ // Setup
+ string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ // Call
+ TestDelegate call = () => new RingtoetsCreateScript(version, query);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("query", paramName);
+ }
+
+ [Test]
+ public void Constructor_ValidParameters_ExpectedValues()
+ {
+ // Setup
+ const string query = "Valid query";
+ string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ // Call
+ var createScript = new RingtoetsCreateScript(version, query);
+
+ // Assert
+ Assert.IsInstanceOf(createScript);
+ Assert.AreEqual(version, createScript.GetVersion());
+ }
+
+ [Test]
+ public void CreateEmptyVersionedFile_FileDoesNotExist_ReturnsVersionedFile()
+ {
+ // Setup
+ const string query = ";";
+ string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ string targetFilename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(targetFilename);
+ var createScript = new RingtoetsCreateScript(version, query);
+
+ // Call
+ IVersionedFile versionedFile = createScript.CreateEmptyVersionedFile(filePath);
+
+ // Assert
+ Assert.IsTrue(File.Exists(versionedFile.Location));
+ File.Delete(filePath);
+ }
+
+ [Test]
+ public void CreateEmptyVersionedFile_FileExistsButNotWritable_ThrowsArgumentException()
+ {
+ // Setup
+ const string query = ";";
+ string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+ var createScript = new RingtoetsCreateScript(version, query);
+
+ using (new FileDisposeHelper(filePath))
+ {
+ FileAttributes attributes = File.GetAttributes(filePath);
+ File.SetAttributes(filePath, attributes | FileAttributes.ReadOnly);
+
+ // Call
+ TestDelegate call = () => createScript.CreateEmptyVersionedFile(filePath);
+
+ // Assert
+ ArgumentException exception = Assert.Throws(call);
+ Assert.AreEqual("path", exception.ParamName);
+ File.SetAttributes(filePath, attributes);
+ }
+ }
+
+ [Test]
+ public void CreateEmptyVersionedFile_QueryFails_ThrowsCriticalMigrationException()
+ {
+ // Setup
+ const string query = "THIS WILL FAIL";
+ string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ string targetFilename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(targetFilename);
+ var createScript = new RingtoetsCreateScript(version, query);
+
+ // Call
+ TestDelegate call = () => createScript.CreateEmptyVersionedFile(filePath);
+
+ // Assert
+ using (new FileDisposeHelper(filePath))
+ {
+ CriticalMigrationException exception = Assert.Throws(call);
+ Assert.AreEqual($"Het aanmaken van het Ringtoets projectbestand met versie '{version}' is mislukt.",
+ exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseFileTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseFileTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseFileTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,167 @@
+// 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.Data.SQLite;
+using System.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsDatabaseFileTest
+ {
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void Constructor_FilePathNullOrWhiteSpace_ThrowsArgumentException(string filePath)
+ {
+ // Call
+ TestDelegate call = () =>
+ {
+ using (new RingtoetsDatabaseFile(filePath)) {}
+ };
+
+ // Assert
+ ArgumentException exception = Assert.Throws(call);
+ Assert.AreEqual($"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet leeg of ongedefinieerd zijn.", exception.Message);
+ }
+
+ [Test]
+ public void Constructor_FileNotWritable_ThrowsArgumentException()
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+
+ using (new FileDisposeHelper(filePath))
+ {
+ FileAttributes attributes = File.GetAttributes(filePath);
+ File.SetAttributes(filePath, attributes | FileAttributes.ReadOnly);
+ try
+ {
+ // Call
+ TestDelegate call = () =>
+ {
+ using (new RingtoetsDatabaseFile(filePath)) {}
+ };
+
+ // Assert
+ string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+ finally
+ {
+ File.SetAttributes(filePath, attributes);
+ }
+ }
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void ExecuteQuery_QueryIsNullOrWhiteSpace_ThrowsArgumentException(string query)
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+
+ using (new FileDisposeHelper(filePath))
+ using (var databaseFile = new RingtoetsDatabaseFile(filePath))
+ {
+ databaseFile.OpenDatabaseConnection();
+
+ // Call
+ TestDelegate call = () => databaseFile.ExecuteQuery(query);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Parameter must be a valid database script.");
+ }
+ }
+
+ [Test]
+ public void ExecuteQuery_InvalidQuery_ThrowsSQLiteException()
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+
+ using (new FileDisposeHelper(filePath))
+ using (var databaseFile = new RingtoetsDatabaseFile(filePath))
+ {
+ databaseFile.OpenDatabaseConnection();
+
+ // Call
+ TestDelegate call = () => databaseFile.ExecuteQuery("THIS WILL FAIL");
+
+ // Assert
+ Assert.Throws(call);
+ }
+ }
+
+ [Test]
+ public void ExecuteQuery_ValidQuery_CreatesFile()
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+
+ using (var databaseFile = new RingtoetsDatabaseFile(filePath))
+ {
+ databaseFile.OpenDatabaseConnection();
+
+ // Call
+ databaseFile.ExecuteQuery(";");
+
+ // Assert
+ Assert.IsTrue(File.Exists(filePath));
+ }
+
+ using (new FileDisposeHelper(filePath)) {}
+ }
+
+ [Test]
+ public void Dispose_AlreadyDisposed_DoesNotThrowException()
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+
+ // Call
+ TestDelegate call = () =>
+ {
+ using (var databaseFile = new RingtoetsDatabaseFile(filePath))
+ {
+ databaseFile.Dispose();
+ }
+ };
+
+ using (new FileDisposeHelper(filePath))
+ {
+ // Assert
+ Assert.DoesNotThrow(call);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseQueryBuilderTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseQueryBuilderTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseQueryBuilderTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,40 @@
+// 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 NUnit.Framework;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsDatabaseQueryBuilderTest
+ {
+ [Test]
+ public void GetVersionQuery_ReturnsExpectedQuery()
+ {
+ // Call
+ string getVersionQuery = RingtoetsDatabaseQueryBuilder.GetVersionQuery();
+
+ // Assert
+ Assert.AreEqual("SELECT Version FROM VersionEntity Order by Timestamp DESC LIMIT 1",
+ getVersionQuery);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseSourceFileTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseSourceFileTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsDatabaseSourceFileTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,124 @@
+// 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.IO;
+using Core.Common.Base.Storage;
+using Core.Common.IO.Exceptions;
+using Core.Common.IO.Readers;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsDatabaseSourceFileTest
+ {
+ private static readonly TestDataPath testPath = TestDataPath.Application.Ringtoets.Migration;
+
+ [Test]
+ public void Constructor_NonExistingPath_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string fileName = Path.GetRandomFileName();
+ string filePath = TestHelper.GetTestDataPath(testPath, fileName);
+
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new RingtoetsDatabaseSourceFile(filePath)) {}
+ };
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual($"Fout bij het lezen van bestand '{filePath}': het bestand bestaat niet.",
+ exception.Message);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ public void Constructor_FileNullOrEmpty_ThrowsCriticalFileReadException(string filePath)
+ {
+ // Call
+ TestDelegate test = () =>
+ {
+ using (new RingtoetsDatabaseSourceFile(filePath)) {}
+ };
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual($"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet leeg of ongedefinieerd zijn.",
+ exception.Message);
+ }
+
+ [Test]
+ public void Constructor_ValidPath_ExpectedProperties()
+ {
+ // Setup
+ string fileName = Path.GetRandomFileName();
+ string filePath = TestHelper.GetTestDataPath(testPath, fileName);
+
+ // Call
+ using (new FileDisposeHelper(filePath))
+ using (var file = new RingtoetsDatabaseSourceFile(filePath))
+ {
+ // Assert
+ Assert.IsInstanceOf(file);
+ }
+ }
+
+ [Test]
+ public void GetVersion_EmptyFile_ThrowsStorageValidationException()
+ {
+ // Setup
+ string fileName = Path.GetRandomFileName();
+ string filePath = TestHelper.GetTestDataPath(testPath, fileName);
+
+ using (new FileDisposeHelper(filePath))
+ using (var file = new RingtoetsDatabaseSourceFile(filePath))
+ {
+ // Call
+ TestDelegate call = () => file.GetVersion();
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Het bestand '{filePath}' moet een geldig Ringtoets projectbestand zijn.",
+ message);
+ }
+ }
+
+ [Test]
+ public void GetVersion_EmptyRingtoetsDatabaseFile_ReturnsEmpty()
+ {
+ // Setup
+ string filePath = TestHelper.GetTestDataPath(testPath, "EmptyDatabase.rtd");
+
+ using (var file = new RingtoetsDatabaseSourceFile(filePath))
+ {
+ // Call
+ string version = file.GetVersion();
+
+ // Assert
+ Assert.AreEqual(string.Empty, version);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsMigratorTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsMigratorTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsMigratorTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,113 @@
+// 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 Migration.Core.Storage;
+using NUnit.Framework;
+using Rhino.Mocks;
+
+namespace Application.Ringtoets.Migration.Test
+{
+ [TestFixture]
+ public class RingtoetsMigratorTest
+ {
+ private MockRepository mocks;
+
+ [SetUp]
+ public void Setup()
+ {
+ mocks = new MockRepository();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_InquiryHelperNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new RingtoetsMigrator(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("versionedFileMigrator", paramName);
+ }
+
+ [Test]
+ public void ShouldMigrate_SourcePathNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var versionedFileMigrator = mocks.Stub();
+ var migrator = new RingtoetsMigrator(versionedFileMigrator);
+
+ // Call
+ TestDelegate call = () => migrator.ShouldMigrate(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sourcePath", paramName);
+ }
+
+ [Test]
+ public void ShouldMigrateInvalidFilePath_ThrowsArgumentException()
+ {
+ // Setup
+ var versionedFileMigrator = mocks.Stub();
+ var migrator = new RingtoetsMigrator(versionedFileMigrator);
+
+ // Call
+ TestDelegate call = () => migrator.ShouldMigrate(null);
+ }
+
+ [Test]
+ public void Migrate_SourcePathNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var versionedFileMigrator = mocks.Stub();
+ var migrator = new RingtoetsMigrator(versionedFileMigrator);
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(null, string.Empty);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sourcePath", paramName);
+ }
+
+ [Test]
+ public void Migrate_TargetPathNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var versionedFileMigrator = mocks.Stub();
+ var migrator = new RingtoetsMigrator(versionedFileMigrator);
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(string.Empty, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("targetPath", paramName);
+ }
+ }
+}
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,242 @@
+// 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.IO;
+using Core.Common.TestUtil;
+using Migration.Core.Storage;
+using Migration.Scripts.Data.Exceptions;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsSqLiteDatabaseFileMigratorTest
+ {
+ [Test]
+ public void Constructor_ReturnsExpectedValues()
+ {
+ // Call
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Assert
+ Assert.IsInstanceOf(migrator);
+ }
+
+ [Test]
+ public void IsVersionSupported_SupportedVersion_ReturnsTrue()
+ {
+ // Setup
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ bool isSupported = migrator.IsVersionSupported("5");
+
+ // Assert
+ Assert.IsTrue(isSupported);
+ }
+
+ [Test]
+ [TestCase("16.4")]
+ [TestCase("17.1")]
+ public void IsVersionSupported_UnsupportedVersion_ReturnsFalse(string fromVersion)
+ {
+ // Setup
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ bool isSupported = migrator.IsVersionSupported(fromVersion);
+
+ // Assert
+ Assert.IsFalse(isSupported);
+ }
+
+ [Test]
+ public void NeedsMigrate_NeedsMigrate_ReturnsTrue()
+ {
+ // Setup
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var versionedFile = new RingtoetsVersionedFile(sourceFilePath);
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ bool needsMigrate = migrator.NeedsMigrate(versionedFile, "17.1");
+
+ // Assert
+ Assert.IsTrue(needsMigrate);
+ }
+
+ [Test]
+ public void NeedsMigrate_DoesNotNeedMigration_ReturnsFalse()
+ {
+ // Setup
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var versionedFile = new RingtoetsVersionedFile(sourceFilePath);
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ bool needsMigrate = migrator.NeedsMigrate(versionedFile, "4");
+
+ // Assert
+ Assert.IsFalse(needsMigrate);
+ }
+
+ [Test]
+ public void Migrate_ValidFiles_SavesFileAtNewLocation()
+ {
+ // Setup
+ const string newVersion = "17.1";
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+
+ string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_ValidFiles_SavesFileAtNewLocation));
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ using (new FileDisposeHelper(targetFilePath))
+ {
+ // Call
+ migrator.Migrate(fromVersionedFile, newVersion, targetFilePath);
+
+ // Assert
+ var toVersionedFile = new RingtoetsVersionedFile(targetFilePath);
+ Assert.AreEqual(newVersion, toVersionedFile.GetVersion());
+ }
+ }
+
+ [Test]
+ public void Migrate_TargetFileInUse_ThrowsCriticalDatabaseMigrationException()
+ {
+ // Setup
+ const string newVersion = "17.1";
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+
+ string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_TargetFileInUse_ThrowsCriticalDatabaseMigrationException));
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ using (var fileDisposeHelper = new FileDisposeHelper(targetFilePath))
+ {
+ fileDisposeHelper.LockFiles();
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(fromVersionedFile, newVersion, targetFilePath);
+
+ // Assert
+ CriticalMigrationException exception = Assert.Throws(call);
+ StringAssert.StartsWith("Het gemigreerde projectbestand is aangemaakt op '", exception.Message);
+ StringAssert.EndsWith($"', maar er is een onverwachte fout opgetreden tijdens het verplaatsen naar '{targetFilePath}'.",
+ exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+ }
+
+ [Test]
+ public void Migrate_TargetFilePathEqualsSourcePath_ThrowsCriticalDatabaseMigrationException()
+ {
+ // Setup
+ const string newVersion = "17.1";
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(fromVersionedFile, newVersion, sourceFilePath);
+
+ // Assert
+ CriticalMigrationException exception = Assert.Throws(call);
+ Assert.AreEqual("Het doelprojectpad moet anders zijn dan het bronprojectpad.",
+ exception.Message);
+ }
+
+ [Test]
+ public void Migrate_TargetFileNotWritable_ThrowsCriticalDatabaseMigrationException()
+ {
+ // Setup
+ const string newVersion = "17.1";
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+
+ string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_TargetFileNotWritable_ThrowsCriticalDatabaseMigrationException));
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ using (new FileDisposeHelper(targetFilePath))
+ {
+ FileAttributes attributes = File.GetAttributes(targetFilePath);
+ File.SetAttributes(targetFilePath, attributes | FileAttributes.ReadOnly);
+
+ try
+ {
+ // Call
+ TestDelegate call = () => migrator.Migrate(fromVersionedFile, newVersion, targetFilePath);
+
+ // Assert
+ CriticalMigrationException exception = Assert.Throws(call);
+ StringAssert.StartsWith("Het gemigreerde projectbestand is aangemaakt op '",
+ exception.Message);
+ StringAssert.EndsWith($"', maar er is een onverwachte fout opgetreden tijdens het verplaatsen naar '{targetFilePath}'.",
+ exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+ finally
+ {
+ File.SetAttributes(targetFilePath, attributes);
+ }
+ }
+ }
+
+ [Test]
+ public void Migrate_InvalidToVersion_ThrowsCriticalDatabaseMigrationException()
+ {
+ // Setup
+ const string newVersion = "6";
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "FullTestProject164.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+
+ string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_InvalidToVersion_ThrowsCriticalDatabaseMigrationException));
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(fromVersionedFile, newVersion, targetFilePath);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Het migreren van een projectbestand met versie '5' naar versie '{newVersion}' is niet ondersteund.", message);
+ }
+
+ [Test]
+ public void Migrate_UnsupportedVersion_ThrowsCriticalDatabaseMigrationException()
+ {
+ // Setup
+ string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, "UnsupportedVersion8.rtd");
+ var fromVersionedFile = new RingtoetsVersionedFile(sourceFilePath);
+
+ string targetFilePath = TestHelper.GetScratchPadPath(nameof(Migrate_UnsupportedVersion_ThrowsCriticalDatabaseMigrationException));
+ var migrator = new RingtoetsSqLiteDatabaseFileMigrator();
+
+ // Call
+ TestDelegate call = () => migrator.Migrate(fromVersionedFile, "17.1", targetFilePath);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual("Het migreren van een projectbestand met versie '8' naar versie '17.1' is niet ondersteund.", message);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsUpgradeScriptTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsUpgradeScriptTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsUpgradeScriptTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,175 @@
+// 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.Data.SQLite;
+using System.IO;
+using Core.Common.TestUtil;
+using Migration.Scripts.Data;
+using Migration.Scripts.Data.Exceptions;
+using NUnit.Framework;
+using Ringtoets.Common.Utils;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsUpgradeScriptTest
+ {
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void Constructor_FromVersionNullOrEmpty_ThrowsArgumentException(string fromVersion)
+ {
+ // Setup
+ const string query = "Valid query";
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ // Call
+ TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("fromVersion", paramName);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ public void Constructor_ToVersionNullOrEmpty_ThrowsArgumentException(string toVersion)
+ {
+ // Setup
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ const string query = "Valid query";
+
+ // Call
+ TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("toVersion", paramName);
+ }
+
+ [Test]
+ [TestCase("4")]
+ public void Constructor_InvalidFromVersion_ThrowsArgumentException(string fromVersion)
+ {
+ // Setup
+ const string query = "Valid query";
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ // Call
+ TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ string expectedMessage = $@"'{fromVersion}' is geen geldige Ringtoets versie.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ [TestCase("4")]
+ public void Constructor_InvalidToVersion_ThrowsArgumentException(string toVersion)
+ {
+ // Setup
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ const string query = "Valid query";
+
+ // Call
+ TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ string expectedMessage = $@"'{toVersion}' is geen geldige Ringtoets versie.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void Constructor_InvalidQuery_ThrowsArgumentException(string query)
+ {
+ // Setup
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ // Call
+ TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("query", paramName);
+ }
+
+ [Test]
+ public void Constructor_ValidParameters_ReturnsExpectedValues()
+ {
+ // Setup
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ const string query = ";";
+
+ // Call
+ var upgradeScript = new RingtoetsUpgradeScript(fromVersion, toVersion, query);
+
+ // Assert
+ Assert.IsInstanceOf(upgradeScript);
+ Assert.AreEqual(fromVersion, upgradeScript.FromVersion());
+ Assert.AreEqual(toVersion, upgradeScript.ToVersion());
+ }
+
+ [Test]
+ public void Upgrade_UpgradeFails_ThrowsCriticalMigrationException()
+ {
+ // Setup
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ var upgradeScript = new RingtoetsUpgradeScript(fromVersion, toVersion, "THIS WILL FAIL");
+
+ // Call
+ TestDelegate call = () => upgradeScript.Upgrade("c:\\file.ext", "c:\\file.ext");
+
+ // Assert
+ CriticalMigrationException exception = Assert.Throws(call);
+ Assert.AreEqual($"Het migreren van het Ringtoets projectbestand van versie '{fromVersion}' naar '{fromVersion}' is mislukt.",
+ exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+
+ [Test]
+ public void Upgrade_ValidParameters_ExpectedProperties()
+ {
+ // Setup
+ string filename = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(filename);
+ string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+ string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion();
+
+ var upgradeScript = new RingtoetsUpgradeScript(fromVersion, toVersion, ";");
+
+ // Call
+ upgradeScript.Upgrade("c:\\file.ext", filePath);
+
+ // Assert
+ Assert.IsTrue(File.Exists(filePath));
+ File.Delete(filePath);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsVersionedFileTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsVersionedFileTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/RingtoetsVersionedFileTest.cs (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,115 @@
+// 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.IO;
+using Core.Common.IO.Exceptions;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Migration.Core.Test
+{
+ [TestFixture]
+ public class RingtoetsVersionedFileTest
+ {
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase(null)]
+ public void Constructor_InvalidPath_ThrowsArgumentException(string filePath)
+ {
+ // Call
+ TestDelegate call = () => new RingtoetsVersionedFile(filePath);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Fout bij het lezen van bestand '{filePath}': bestandspad mag niet leeg of ongedefinieerd zijn.", message);
+ }
+
+ [Test]
+ public void Constructor_ValidfilePath_ExpectedProperties()
+ {
+ // Setup
+ string filePath = "c:\\file.ext";
+
+ // Call
+ var versionedFile = new RingtoetsVersionedFile(filePath);
+
+ // Assert
+ Assert.AreEqual(filePath, versionedFile.Location);
+ }
+
+ [Test]
+ public void GetVersion_FileDoesNotExist_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string file = Path.GetRandomFileName();
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file);
+
+ var sourceFile = new RingtoetsVersionedFile(filePath);
+
+ // Precondition
+ Assert.IsFalse(File.Exists(filePath), $"File should not exist at location '{filePath}'");
+
+ // Call
+ TestDelegate call = () => sourceFile.GetVersion();
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void GetVersion_FileCannotBeRead_ThrowsCriticalFileReadException()
+ {
+ // Setup
+ string file = Path.GetRandomFileName();
+ string filePath = TestHelper.GetScratchPadPath(file);
+
+ var sourceFile = new RingtoetsVersionedFile(filePath);
+
+ using (var fileDisposeHelper = new FileDisposeHelper(filePath))
+ {
+ fileDisposeHelper.LockFiles();
+
+ // Call
+ TestDelegate call = () => sourceFile.GetVersion();
+
+ // Assert
+ Assert.Throws(call);
+ }
+ }
+
+ [TestCase("FullTestProject164.rtd", "5")]
+ [TestCase("FullTestProject171.rtd", "17.1")]
+ public void GetVersion_ParameteredConstructor_ExptectedProperties(string file, string expectedVersion)
+ {
+ // Setup
+ string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, file);
+ var sourceFile = new RingtoetsVersionedFile(filePath);
+
+ // Call
+ var version = sourceFile.GetVersion();
+
+ // Assert
+ Assert.AreEqual(expectedVersion, version);
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/packages.config
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/packages.config (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/packages.config (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/1fkxcm1k.eyd
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/1tod5qxe.emb
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/3ezlhpsr.ys3
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/44mj1vrv.hrr
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/5ebjbcmk.lyg
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/EmptyDatabase.rtd
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject164.rtd
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/FullTestProject171.rtd
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/UnsupportedVersion8.rtd
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/buzw15rf.yzu
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/dbvaddho.gfg
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/kcj240pg.tyv
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/mca2v5sl.ugy
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/mwdvkzch.sfh
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/p44vgc15.ne3
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/pdg0ot0y.hwg
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/ru1qlhoh.dzv
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/wy40stzy.y1s
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/xhg0arkf.hd0
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/y50etn0q.xz5
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Core.Test/test-data/ydzogal4.aie
===================================================================
diff -u
Binary files differ
Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj
===================================================================
diff -u -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd -r9d68a734d8da9bfadd3bdd349ddb56fb70d461ec
--- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj (.../Application.Ringtoets.Migration.Test.csproj) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd)
+++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj (.../Application.Ringtoets.Migration.Test.csproj) (revision 9d68a734d8da9bfadd3bdd349ddb56fb70d461ec)
@@ -3,7 +3,7 @@
Debugx86
- {40CF9BC7-3CDE-4AC0-B31A-851694821772}
+ {408F6A6B-7BF7-4F59-A5D4-893A777921D3}LibraryPropertiesApplication.Ringtoets.Migration.Test
@@ -35,79 +35,16 @@
none
-
- ..\..\..\..\packages\NUnit.3.6.0\lib\net40\nunit.framework.dll
- True
-
-
- ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll
- True
-
-
-
- False
- ..\..\..\..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll
-
-
+
Properties\GlobalAssembly.cs
-
-
-
-
-
-
-
-
-
- Copying.licenseheader
-
-
-
-
-
- {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
- Core.Common.Base
-
-
- {E344867E-9AC9-44C8-88A5-8185681679A9}
- Core.Common.IO
-
-
- {D749EE4C-CE50-4C17-BF01-9A953028C126}
- Core.Common.TestUtil
-
-
- {efd7e662-5b69-4b71-a448-565b64e9c033}
- Migration.Core.Storage
-
-
- {d08db9e2-6861-44c8-a725-71a70274cc77}
- Migration.Scripts.Data
-
-
- {6A074D65-A81C-4C1C-8E24-F36C916E4ED7}
- Ringtoets.Common.Utils
-
-
- {FAC55B92-E259-43D6-B9A1-5BDA6C834359}
- Application.Ringtoets.Migration
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-