diff --git a/PresentValueSeries/InitializeData.ipynb b/PresentValueSeries/InitializeData.ipynb
index eacf5385..a7dc504d 100644
--- a/PresentValueSeries/InitializeData.ipynb
+++ b/PresentValueSeries/InitializeData.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "HSWSJivQ9Uq-k7P9Ky6MAg",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
- },
- "toc-autonumbering": "True",
- "toc-showcode": "False",
- "toc-showmarkdowntxt": "False",
- "toc-showtags": "False"
+ }
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
@@ -108,4 +105,4 @@
"outputs": []
}
]
-}
+}
\ No newline at end of file
diff --git a/PresentValueSeries/PresentValue - Episode 2.ipynb b/PresentValueSeries/PresentValue - Episode 2.ipynb
index 70a4c51a..2a33a1c7 100644
--- a/PresentValueSeries/PresentValue - Episode 2.ipynb
+++ b/PresentValueSeries/PresentValue - Episode 2.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "HmaHGel-LEeFl0jOhE9pPw",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
- },
- "toc-autonumbering": "True",
- "toc-showcode": "False",
- "toc-showmarkdowntxt": "False",
- "toc-showtags": "False"
+ }
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
diff --git a/PresentValueSeries/PresentValue - Episode 3.ipynb b/PresentValueSeries/PresentValue - Episode 3.ipynb
index 0c3d4211..a8b09155 100644
--- a/PresentValueSeries/PresentValue - Episode 3.ipynb
+++ b/PresentValueSeries/PresentValue - Episode 3.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "UQV1FkirrkmGCOCfpHVsEA",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
- },
- "toc-autonumbering": "True",
- "toc-showcode": "False",
- "toc-showmarkdowntxt": "False",
- "toc-showtags": "False"
+ }
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
diff --git a/PresentValueSeries/Test.ipynb b/PresentValueSeries/Test.ipynb
index 25430e56..049a72e7 100644
--- a/PresentValueSeries/Test.ipynb
+++ b/PresentValueSeries/Test.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "t7h_PHrvb0GNmLCXuxb1kg",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -13,7 +14,7 @@
}
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
diff --git a/ifrs17-template/Constants/CalculationEngine.ipynb b/ifrs17-template/Constants/CalculationEngine.ipynb
index 4ce89cf3..c3f4e015 100644
--- a/ifrs17-template/Constants/CalculationEngine.ipynb
+++ b/ifrs17-template/Constants/CalculationEngine.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "ORrEbLR_T0C1aoQoVcXCpA",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -13,13 +14,13 @@
}
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "code",
"source": [
"var projectName = \"ifrs17\";",
- "\nvar environmentName = \"v1.1.1\";",
+ "\nvar environmentName = \"v1.2.0\";",
"\nvar notebookName = \"CalculationEngine\";",
"\nvar calculationEngine = $\"#!import \\\"//{projectName}/{environmentName}/{notebookName}\\\"\";"
],
diff --git a/ifrs17-template/Database/Configure.ipynb b/ifrs17-template/Database/Configure.ipynb
index c536ff36..2ff22d3b 100644
--- a/ifrs17-template/Database/Configure.ipynb
+++ b/ifrs17-template/Database/Configure.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
+ "id": "NKif7XZ_00aa5ksgQlE6_g",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
@@ -10,13 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
- },
- "toc-autonumbering": "True",
- "toc-showcode": "False",
- "toc-showmarkdowntxt": "False"
+ }
},
"nbformat": 4,
- "nbformat_minor": 5,
+ "nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
@@ -81,7 +79,10 @@
"cell_type": "code",
"source": [
"await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
- "\n .WithTypes(allTypes)) .ConnectAsync();"
+ "\n .WithTypes(allTypes)",
+ "\n // .WithMigration() // uncomment if run with migration",
+ "\n ) ",
+ "\n .ConnectAsync();"
],
"metadata": {},
"execution_count": 0,
diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb
new file mode 100644
index 00000000..223e80bd
--- /dev/null
+++ b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb
@@ -0,0 +1,729 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "vjKyjbrTjk-dDxMZiTA1Mg",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 8,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ "
The Initial Migration Code
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "This copy contains the copy of the initial migration code. It is a necessary input to execute the first migration flow. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "[Migration(\"20230208105811_InitialTypes\")]",
+ "\npublic class InitialTypes : Migration",
+ "\n{",
+ "\n protected override void Up(MigrationBuilder migrationBuilder)",
+ "\n {",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"AmountType\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n PeriodType = table.Column(type: \"int\", nullable: false),",
+ "\n Discriminator = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false),",
+ "\n ExternalId = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_AmountType\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"AocConfiguration\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n AocType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Novelty = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DataType = table.Column(type: \"int\", nullable: false),",
+ "\n InputSource = table.Column(type: \"int\", nullable: false),",
+ "\n FxPeriod = table.Column(type: \"int\", nullable: false),",
+ "\n YcPeriod = table.Column(type: \"int\", nullable: false),",
+ "\n CdrPeriod = table.Column(type: \"int\", nullable: false),",
+ "\n ValuationPeriod = table.Column(type: \"int\", nullable: false),",
+ "\n RcPeriod = table.Column(type: \"int\", nullable: false),",
+ "\n Order = table.Column(type: \"int\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_AocConfiguration\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"CreditDefaultRate\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n CreditRiskRating = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n Values = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_CreditDefaultRate\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"CreditRiskRating\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_CreditRiskRating\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"Currency\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_Currency\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"DataNode\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Partition = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n ContractualCurrency = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n FunctionalCurrency = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n LineOfBusiness = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ValuationApproach = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n OciType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Discriminator = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n AnnualCohort = table.Column(type: \"int\", nullable: true),",
+ "\n LiabilityType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Profitability = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Portfolio = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n YieldCurveName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Partner = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_DataNode\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"DataNodeParameter\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Partition = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n DataNode = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Discriminator = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n LinkedDataNode = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ReinsuranceCoverage = table.Column(type: \"float\", nullable: true),",
+ "\n PremiumAllocation = table.Column(type: \"float\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_DataNodeParameter\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"DataNodeState\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Partition = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n DataNode = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n State = table.Column(type: \"int\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_DataNodeState\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"EconomicBasis\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_EconomicBasis\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"EstimateType\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n InputSource = table.Column(type: \"int\", nullable: false),",
+ "\n StructureType = table.Column(type: \"int\", nullable: false),",
+ "\n PeriodType = table.Column(type: \"int\", nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false),",
+ "\n ExternalId = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_EstimateType\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ExchangeRate\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Currency = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n FxType = table.Column(type: \"int\", nullable: false),",
+ "\n FxToGroupCurrency = table.Column(type: \"float\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ExchangeRate\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ExportFile\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Name = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ContentType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n CreationTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n SerializedContent = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Length = table.Column(type: \"bigint\", nullable: true),",
+ "\n Format = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ExportFile\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"IfrsVariable\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Value = table.Column(type: \"float\", nullable: false),",
+ "\n EstimateType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n EconomicBasis = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DataNode = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n AocType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Novelty = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Partition = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n AmountType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n AccidentYear = table.Column(type: \"int\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_IfrsVariable\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ImportDataSet\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n CreationTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n SerializedContent = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Length = table.Column(type: \"bigint\", nullable: true),",
+ "\n Format = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ImportDataSet\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ImportExportActivity\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Username = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n StartDateTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n EndDateTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n Status = table.Column(type: \"int\", nullable: false),",
+ "\n Category = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ExceptionMessage = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ErrorMessages = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n WarningMessages = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n InfoMessages = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n SourceId = table.Column(type: \"uniqueidentifier\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ImportExportActivity\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ImportFile\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Name = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Directory = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ContentType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Partition = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Source = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n CreationTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n SerializedContent = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Length = table.Column(type: \"bigint\", nullable: true),",
+ "\n Format = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ImportFile\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ImportStream\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n CreationTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n SerializedContent = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Length = table.Column(type: \"bigint\", nullable: true),",
+ "\n Format = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ImportStream\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ImportString\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Content = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n CreationTime = table.Column(type: \"datetime2\", nullable: false),",
+ "\n SerializedContent = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n Length = table.Column(type: \"bigint\", nullable: true),",
+ "\n Format = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ImportString\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"LiabilityType\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_LiabilityType\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"LineOfBusiness\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_LineOfBusiness\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"Novelty\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_Novelty\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"OciType\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_OciType\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"PartitionByReportingNode\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n ReportingNode = table.Column(type: \"nvarchar(max)\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_PartitionByReportingNode\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"PartitionByReportingNodeAndPeriod\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n ReportingNode = table.Column(type: \"nvarchar(max)\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_PartitionByReportingNodeAndPeriod\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"Partner\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_Partner\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"PartnerRating\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Partner = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n CreditRiskRating = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_PartnerRating\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"Profitability\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_Profitability\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ProjectionConfiguration\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Shift = table.Column(type: \"int\", nullable: false),",
+ "\n TimeStep = table.Column(type: \"int\", nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ProjectionConfiguration\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"RawVariable\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Values = table.Column(type: \"varbinary(max)\", nullable: true),",
+ "\n EstimateType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DataNode = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n AocType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Novelty = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Partition = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n AmountType = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n AccidentYear = table.Column(type: \"int\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_RawVariable\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ReportingNode\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Currency = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ReportingNode\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"RiskDriver\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_RiskDriver\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"Scenario\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_Scenario\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"ValuationApproach\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_ValuationApproach\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"VariableType\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n SystemName = table.Column(type: \"nvarchar(16)\", maxLength: 16, nullable: false),",
+ "\n Parent = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Discriminator = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n DisplayName = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Order = table.Column(type: \"int\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_VariableType\", x => x.SystemName);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"YieldCurve\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Currency = table.Column(type: \"nvarchar(max)\", nullable: false),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Name = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Values = table.Column(type: \"varbinary(max)\", nullable: true)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_YieldCurve\", x => x.Id);",
+ "\n });",
+ "\n",
+ "\n migrationBuilder.CreateTable(",
+ "\n name: \"YieldCurveReport\",",
+ "\n columns: table => new",
+ "\n {",
+ "\n Id = table.Column(type: \"uniqueidentifier\", nullable: false),",
+ "\n Currency = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Year = table.Column(type: \"int\", nullable: false),",
+ "\n Month = table.Column(type: \"int\", nullable: false),",
+ "\n Scenario = table.Column(type: \"nvarchar(max)\", nullable: true),",
+ "\n Index = table.Column(type: \"int\", nullable: false),",
+ "\n Value = table.Column(type: \"float\", nullable: false)",
+ "\n },",
+ "\n constraints: table =>",
+ "\n {",
+ "\n table.PrimaryKey(\"PK_YieldCurveReport\", x => x.Id);",
+ "\n });",
+ "\n }",
+ "\n",
+ "\n protected override void Down(MigrationBuilder migrationBuilder)",
+ "\n {",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"AmountType\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"AocConfiguration\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"CreditDefaultRate\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"CreditRiskRating\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"Currency\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"DataNode\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"DataNodeParameter\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"DataNodeState\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"EconomicBasis\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"EstimateType\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ExchangeRate\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ExportFile\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"IfrsVariable\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ImportDataSet\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ImportExportActivity\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ImportFile\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ImportStream\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ImportString\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"LiabilityType\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"LineOfBusiness\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"Novelty\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"OciType\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"PartitionByReportingNode\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"PartitionByReportingNodeAndPeriod\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"Partner\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"PartnerRating\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"Profitability\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ProjectionConfiguration\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"RawVariable\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ReportingNode\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"RiskDriver\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"Scenario\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"ValuationApproach\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"VariableType\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"YieldCurve\");",
+ "\n",
+ "\n migrationBuilder.DropTable(",
+ "\n name: \"YieldCurveReport\");",
+ "\n }",
+ "\n}",
+ "\n"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb
new file mode 100644
index 00000000..d7bbb00c
--- /dev/null
+++ b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb
@@ -0,0 +1,87 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "oPiKSNUZMki5wrdUJlHjPQ",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 8,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Migration Flow
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#r \"nuget:Systemorph.SchemaMigrations,1.6.3\"",
+ "\n#!import \"../PersonalConnectionExample\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "For the initial migration one needs a migration code from the Initial notebook, so we import it here. For any subsequent migrations please change the next cell to import the notebook, where your stored the relevant migration code."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"Initial\""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Here is the migration of the data base. For all subsequent migrations, please replace the InitialTypes in the second row with the name, that you gave to your migration. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "await SchemaMigrations",
+ "\n .Apply() // Change the class in <> for future migrations",
+ "\n .ToMsSql(connectionStringMsSql)",
+ "\n .MigrateAsync();"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb
new file mode 100644
index 00000000..3863c81d
--- /dev/null
+++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb
@@ -0,0 +1,127 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "bq9bMSDFR02hhSb_XpjkBQ",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 8,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Explanation of Migration and Scaffolding
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# Brief Explanation of Migration"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Migration is a powerful tool that allows us to keep the same Database (DB) during the whole lifetime of the project, without any need to remove it if one needs to modify the DB, e.g. via addition or removing certain tables or columns. With the migration, if modification of the DB is needed, we do not remove the old DB, but rather migrate it incrementally. Note, however, that running a project with migration is a choice rather than a default option. If you are OK with removing the DB each time when some change in the tables structure is needed, migration is not necessary. ",
+ "\n",
+ "\nAt the first step we perform the [scaffolding](Scaffold). The scaffolding procedure naturally outputs the migration code and the model snapshot. The migration code is the code that we should run in order to change the DB according to our new requirements, or, alternatively, if we start from scratch, to create the DB. The snapshot contains all the information about the structure of the DB after the migration. It is necessary to have the snapshot, in order for us not to start from scratch at the next migration, but rather only *implement the changes*. Each time when the DB has to be changed, we should scaffold the new model, taking into account the snapshot of the previous step. The snapshot of the new scaffold should be copied manually without changes into the [Snapshot notebook](Snapshot). We have done it already for the initial migration, please do not forget to change the [Snapshot notebook](Snapshot) for any subsequent migration.",
+ "\n",
+ "\nAt the next step the migration code should be copied into a new notebook. The first one was copied into the [Initial notebook](Initial). Of course, it would make a lot of sense to add each new incremental migration into a new notebook inside this folder. ",
+ "\n",
+ "\nFinally, in order to update or initiate the DB, one should run the [Migration flow notebook](MigrationFlow) where we feed all the necessary information from the [personal connection](../PersonalConnectionExample) and the notebook that includes the migration code, which is the [Initial notebook](Initial) for the first migration. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "# A Handful of Comments on Migration"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Do Not Delete "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Since the logic migration includes incremental changes, while adding or removing something from the DB, one should not delete the schema anymore. Therefore, the [schema deletion notebook](../SchemaDelete) must not be used. ",
+ "\n",
+ "\nSince migration is not a default mode, we are still leaving this notebook in the folder. However, note that now using it would contradict the logic of migration, so please do not do it light-headedly. Stick to migration if this is your choice."
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Configure"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Before you execute the [Configure notebook](../Configure), please uncomment the row, that specifies that the Configuration is run with migration. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "## Initialize"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Note, that when the schema is created, it is not filled automatically via running the [Configure](../Configure) notebook. Therefore there is a need to initaliaze the DB manually via [this](../../Initialization/InitSystemorphToDatabase) notebook. Otherwise you will get a correctly structured, but completely empty DB "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb
new file mode 100644
index 00000000..435abf39
--- /dev/null
+++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb
@@ -0,0 +1,131 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "6wyTMSMvdEK_4OlFd8bqJA",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 8,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " Scaffolding
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "#!import \"../../Constants/CalculationEngine\"",
+ "\n#!eval calculationEngine"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "At the first stage we generate an array of classes that we are about to scaffold. Here we scuffold old the suitable classes that have keys (we want to have a unique identifier of each object in the DB) and are not interfaces or abstract classes, because in general we are not going to have instance of such abstract objects like interface or abstract class. You personal choice might be even narrower than that, in this case just mofify the code in the cell below. Note that the array of types that you are going to scaffold must have no repetitions. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "var allTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())",
+ "\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))",
+ "\n && !t.IsInterface",
+ "\n && !t.IsAbstract",
+ "\n ).ToArray();"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Start from the scaffolding of the initial types. Please make sure that you run this code *only at the first you create the DB*. For any subsequent changes, please comment this cell out and never use it again. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "var migration = SchemaMigrations",
+ "\n .ConfigureScaffolder(allTypes)",
+ "\n .ForMsSql()",
+ "\n .Scaffold(\"InitialTypes\");"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "In order to perform any subsequent change in the DB, there is no need to erase the DB and create a new from the scratch. It is sufficient to erase the cell above and uncomment the following cell. Please do not forget to insert a proper array of classes that you'd like to scaffold in the third row, as well as to give your own unique name to this migration in the 5th line. This is exactly the name that are going to use in the migration flow. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "//#!import \"Snapshot\"",
+ "\n//var migration = SchemaMigrations",
+ "\n// .ConfigureScaffolder({your array of types here}, new DbModelSnapshot())",
+ "\n// .ForMsSql()",
+ "\n// .Scaffold({Your unique name here}); "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "migration.MigrationCode"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "migration.SnapshotCode"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ ""
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb
new file mode 100644
index 00000000..532ff740
--- /dev/null
+++ b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb
@@ -0,0 +1,1081 @@
+{
+ "metadata": {
+ "authors": [],
+ "id": "JQaVP3MiNEiUST8hRneHpQ",
+ "kernelspec": {
+ "display_name": "Formula Framework",
+ "language": "C#",
+ "name": "C#"
+ },
+ "language_info": {
+ "file_extension": ".cs",
+ "mimetype": "text/plain",
+ "name": "C#"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 8,
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "source": [
+ " The Current Snapshot
"
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "Each time you produce a new migration, please copy and paste the snapshot code directly here. This must be the copy of the *most recent* migration snapshot. "
+ ],
+ "metadata": {},
+ "execution_count": 0,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "using Microsoft.EntityFrameworkCore;",
+ "\nusing Microsoft.EntityFrameworkCore.Infrastructure;",
+ "\nusing Microsoft.EntityFrameworkCore.Metadata;",
+ "\n",
+ "\npublic class DbModelSnapshot : ModelSnapshot",
+ "\n{",
+ "\n protected override void BuildModel(ModelBuilder modelBuilder)",
+ "\n {",
+ "\n modelBuilder",
+ "\n .HasAnnotation(\"ProductVersion\", \"6.0.1\")",
+ "\n .HasAnnotation(\"Relational:MaxIdentifierLength\", 128);",
+ "\n",
+ "\n SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_151+YieldCurveReport\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"Currency\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Index\")",
+ "\n .HasColumnType(\"int\");",
+ "\n",
+ "\n b.Property(\"Month\")",
+ "\n .HasColumnType(\"int\");",
+ "\n",
+ "\n b.Property(\"Scenario\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Value\")",
+ "\n .HasColumnType(\"float\");",
+ "\n",
+ "\n b.Property(\"Year\")",
+ "\n .HasColumnType(\"int\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"YieldCurveReport\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_287+ImportExportActivity\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"Category\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"EndDateTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"ErrorMessages\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"ExceptionMessage\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"InfoMessages\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"SourceId\")",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"StartDateTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"Status\")",
+ "\n .HasColumnType(\"int\");",
+ "\n",
+ "\n b.Property(\"Username\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"WarningMessages\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"ImportExportActivity\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_289+ExportFile\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"ContentType\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"CreationTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"Format\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Length\")",
+ "\n .HasColumnType(\"bigint\");",
+ "\n",
+ "\n b.Property(\"Name\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"SerializedContent\")",
+ "\n .HasColumnType(\"varbinary(max)\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"ExportFile\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_291+ImportFile\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"ContentType\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"CreationTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"Directory\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Format\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Length\")",
+ "\n .HasColumnType(\"bigint\");",
+ "\n",
+ "\n b.Property(\"Name\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Partition\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"SerializedContent\")",
+ "\n .HasColumnType(\"varbinary(max)\");",
+ "\n",
+ "\n b.Property(\"Source\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"ImportFile\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_292+ImportString\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"Content\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"CreationTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"Format\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Length\")",
+ "\n .HasColumnType(\"bigint\");",
+ "\n",
+ "\n b.Property(\"SerializedContent\")",
+ "\n .HasColumnType(\"varbinary(max)\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"ImportString\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_293+ImportDataSet\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property(\"CreationTime\")",
+ "\n .HasColumnType(\"datetime2\");",
+ "\n",
+ "\n b.Property(\"Format\")",
+ "\n .HasColumnType(\"nvarchar(max)\");",
+ "\n",
+ "\n b.Property(\"Length\")",
+ "\n .HasColumnType(\"bigint\");",
+ "\n",
+ "\n b.Property(\"SerializedContent\")",
+ "\n .HasColumnType(\"varbinary(max)\");",
+ "\n",
+ "\n b.HasKey(\"Id\");",
+ "\n",
+ "\n b.ToTable(\"ImportDataSet\");",
+ "\n });",
+ "\n",
+ "\n modelBuilder.Entity(\"Submission_294+ImportStream\", b =>",
+ "\n {",
+ "\n b.Property(\"Id\")",
+ "\n .ValueGeneratedOnAdd()",
+ "\n .HasColumnType(\"uniqueidentifier\");",
+ "\n",
+ "\n b.Property