From 2d03b8bf0e35fe10020e14b963eac8e02cfe58bd Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 17:06:24 +0100 Subject: [PATCH 01/16] scaffolding, snapshot and scheme --- .../MigrationAndScaffolding/Initial.ipynb | 710 +++++++++++ .../MigrationAndScaffolding/Scaffold.ipynb | 157 +++ .../MigrationAndScaffolding/Snapshot.ipynb | 1062 +++++++++++++++++ 3 files changed, 1929 insertions(+) create mode 100644 ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb create mode 100644 ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb create mode 100644 ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb new file mode 100644 index 00000000..1248db27 --- /dev/null +++ b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb @@ -0,0 +1,710 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "code", + "source": [ + "[Migration(\"20230123152129_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/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb new file mode 100644 index 00000000..2d1a3756 --- /dev/null +++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb @@ -0,0 +1,157 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "code", + "source": [ + "#!import \"../../Constants/CalculationEngine\"", + "\n#!eval calculationEngine" + ], + "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 );" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "var allTypesFiltered = allTypes", + "\n .GroupBy(x => x.Name, (k, v) => v.OrderBy(y => Int32.Parse(y.DeclaringType.Name.Substring(11))).Last())", + "\n .ToArray();" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "allTypesFiltered" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "allTypesFiltered.Where((_, i) => i == 0).ToArray()" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "public record AmountType2 : KeyedOrderedDimensionWithExternalId, IHierarchicalDimension", + "\n{", + "\n [Dimension(typeof(AmountType))]", + "\n public string Parent { get; init; }", + "\n ", + "\n [Dimension(typeof(PeriodType))]", + "\n public PeriodType PeriodType { get; init; }", + "\n}" + ], + "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(allTypesFiltered)", + "\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 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." + ], + "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..33158143 --- /dev/null +++ b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb @@ -0,0 +1,1062 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "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_150+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_285+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_287+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_289+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_290+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_291+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_292+ImportStream\", 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(\"ImportStream\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_56+AmountType\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"Discriminator\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"ExternalId\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"PeriodType\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"AmountType\");", + "\n", + "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"AmountType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_58+RiskDriver\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"RiskDriver\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_59+EstimateType\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"ExternalId\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"InputSource\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"PeriodType\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"StructureType\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"EstimateType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_60+Novelty\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"Novelty\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_61+VariableType\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"Discriminator\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"VariableType\");", + "\n", + "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"VariableType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_67+Scenario\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"Scenario\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_68+LineOfBusiness\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"LineOfBusiness\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_69+Currency\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"Currency\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_70+EconomicBasis\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"EconomicBasis\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_71+ValuationApproach\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"ValuationApproach\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_72+LiabilityType\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"LiabilityType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_73+OciType\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"OciType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_74+Profitability\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"Profitability\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_75+Partner\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"Partner\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_76+CreditRiskRating\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"CreditRiskRating\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_77+ReportingNode\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"Currency\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Parent\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"ReportingNode\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_78+ProjectionConfiguration\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Shift\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"TimeStep\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"ProjectionConfiguration\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_79+AocConfiguration\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"AocType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"CdrPeriod\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"DataType\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"FxPeriod\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"InputSource\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Novelty\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Order\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"RcPeriod\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"ValuationPeriod\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"YcPeriod\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"AocConfiguration\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_80+ExchangeRate\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Currency\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"FxToGroupCurrency\")", + "\n .HasColumnType(\"float\");", + "\n", + "\n b.Property(\"FxType\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"ExchangeRate\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_81+CreditDefaultRate\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"CreditRiskRating\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Values\")", + "\n .HasColumnType(\"varbinary(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"CreditDefaultRate\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_82+YieldCurve\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Currency\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Name\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Values\")", + "\n .HasColumnType(\"varbinary(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"YieldCurve\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_83+PartnerRating\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"CreditRiskRating\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Partner\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"PartnerRating\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_85+PartitionByReportingNode\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"ReportingNode\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"PartitionByReportingNode\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_86+PartitionByReportingNodeAndPeriod\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"ReportingNode\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"PartitionByReportingNodeAndPeriod\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_87+DataNode\", b =>", + "\n {", + "\n b.Property(\"SystemName\")", + "\n .HasMaxLength(16)", + "\n .HasColumnType(\"nvarchar(16)\");", + "\n", + "\n b.Property(\"ContractualCurrency\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Discriminator\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DisplayName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"FunctionalCurrency\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"LineOfBusiness\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"OciType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Partition\")", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"ValuationApproach\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasKey(\"SystemName\");", + "\n", + "\n b.ToTable(\"DataNode\");", + "\n", + "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"DataNode\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_91+DataNodeState\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"DataNode\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Partition\")", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"State\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"DataNodeState\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_92+DataNodeParameter\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"DataNode\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Discriminator\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Month\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"Partition\")", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Scenario\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Year\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"DataNodeParameter\");", + "\n", + "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"DataNodeParameter\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_97+RawVariable\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"AccidentYear\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"AmountType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"AocType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DataNode\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"EstimateType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Novelty\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Partition\")", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Values\")", + "\n .HasColumnType(\"varbinary(max)\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"RawVariable\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_98+IfrsVariable\", b =>", + "\n {", + "\n b.Property(\"Id\")", + "\n .ValueGeneratedOnAdd()", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"AccidentYear\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"AmountType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"AocType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"DataNode\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"EconomicBasis\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"EstimateType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Novelty\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Partition\")", + "\n .HasColumnType(\"uniqueidentifier\");", + "\n", + "\n b.Property(\"Value\")", + "\n .HasColumnType(\"float\");", + "\n", + "\n b.HasKey(\"Id\");", + "\n", + "\n b.ToTable(\"IfrsVariable\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_57+DeferrableAmountType\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_56+AmountType\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"DeferrableAmountType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_62+AocType\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"AocType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_64+PnlVariableType\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"PnlVariableType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_65+BsVariableType\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"BsVariableType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_66+AccountingVariableType\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"AccountingVariableType\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_88+Portfolio\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_87+DataNode\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"Portfolio\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_89+GroupOfContract\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_87+DataNode\");", + "\n", + "\n b.Property(\"AnnualCohort\")", + "\n .HasColumnType(\"int\");", + "\n", + "\n b.Property(\"LiabilityType\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Partner\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Portfolio\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"Profitability\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"YieldCurveName\")", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"GroupOfContract\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_93+InterDataNodeParameter\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_92+DataNodeParameter\");", + "\n", + "\n b.Property(\"LinkedDataNode\")", + "\n .IsRequired()", + "\n .HasColumnType(\"nvarchar(max)\");", + "\n", + "\n b.Property(\"ReinsuranceCoverage\")", + "\n .HasColumnType(\"float\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"InterDataNodeParameter\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_93+SingleDataNodeParameter\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_92+DataNodeParameter\");", + "\n", + "\n b.Property(\"PremiumAllocation\")", + "\n .HasColumnType(\"float\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"SingleDataNodeParameter\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_88+InsurancePortfolio\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_88+Portfolio\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"InsurancePortfolio\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_88+ReinsurancePortfolio\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_88+Portfolio\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"ReinsurancePortfolio\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_90+GroupOfInsuranceContract\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_89+GroupOfContract\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"GroupOfInsuranceContract\");", + "\n });", + "\n", + "\n modelBuilder.Entity(\"Submission_90+GroupOfReinsuranceContract\", b =>", + "\n {", + "\n b.HasBaseType(\"Submission_89+GroupOfContract\");", + "\n", + "\n b.HasDiscriminator().HasValue(\"GroupOfReinsuranceContract\");", + "\n });", + "\n }", + "\n}", + "\n" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file From 6f9f4c74d6127f784e09f3e0fa61224f552252ef Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 17:39:25 +0100 Subject: [PATCH 02/16] migration flow and some comments --- .../MigrationAndScaffolding/Initial.ipynb | 9 +++ .../MigrationFlow.ipynb | 77 +++++++++++++++++++ .../MigrationAndScaffolding/Scaffold.ipynb | 34 -------- .../MigrationAndScaffolding/Snapshot.ipynb | 9 +++ 4 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb index 1248db27..b46e31e9 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "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": [ diff --git a/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb new file mode 100644 index 00000000..62b0863c --- /dev/null +++ b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb @@ -0,0 +1,77 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "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/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb index 2d1a3756..c755dde8 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb @@ -49,40 +49,6 @@ "execution_count": 0, "outputs": [] }, - { - "cell_type": "code", - "source": [ - "allTypesFiltered" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "allTypesFiltered.Where((_, i) => i == 0).ToArray()" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "public record AmountType2 : KeyedOrderedDimensionWithExternalId, IHierarchicalDimension", - "\n{", - "\n [Dimension(typeof(AmountType))]", - "\n public string Parent { get; init; }", - "\n ", - "\n [Dimension(typeof(PeriodType))]", - "\n public PeriodType PeriodType { get; init; }", - "\n}" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, { "cell_type": "markdown", "source": [ diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb index 33158143..8b20cf6c 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "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": [ From f741cf19b327898746a1b1d5ac62636807fbb322 Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 17:59:35 +0100 Subject: [PATCH 03/16] update Configure --- ifrs17-template/Database/Configure.ipynb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ifrs17-template/Database/Configure.ipynb b/ifrs17-template/Database/Configure.ipynb index c536ff36..b675f138 100644 --- a/ifrs17-template/Database/Configure.ipynb +++ b/ifrs17-template/Database/Configure.ipynb @@ -81,7 +81,10 @@ "cell_type": "code", "source": [ "await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)", - "\n .WithTypes(allTypes)) .ConnectAsync();" + "\n .WithTypes(allTypes)", + "\n .WithMigration()", + "\n ) ", + "\n .ConnectAsync();" ], "metadata": {}, "execution_count": 0, From 1d4bb95daa41d4707361ab37fd498de767580f18 Mon Sep 17 00:00:00 2001 From: akatz Date: Mon, 23 Jan 2023 18:47:16 +0100 Subject: [PATCH 04/16] explanation file --- .../MigrationAndScaffolding/ReadMe.ipynb | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb new file mode 100644 index 00000000..91f29f93 --- /dev/null +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -0,0 +1,48 @@ +{ + "metadata": { + "authors": [], + "kernelspec": { + "display_name": "Formula Framework", + "language": "C#", + "name": "C#" + }, + "language_info": { + "file_extension": ".cs", + "mimetype": "text/plain", + "name": "C#" + } + }, + "nbformat": 4, + "nbformat_minor": 5, + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Brief Explanation of Migration" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "With the migration, if there is a need to change the data base (DB), we do not remove the old DB, but rather migrate it incrementally.", + "\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, 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 the account the snapshot of the previous step. The snapshot of the new scaffold should be copied manually without changes into the [Snapshot notebook](Snapshot)." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file From 6d6db65b609f688f15561ff8928f073eee3dabb1 Mon Sep 17 00:00:00 2001 From: akatz Date: Tue, 24 Jan 2023 09:43:36 +0100 Subject: [PATCH 05/16] configure --- ifrs17-template/Database/Configure.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/Configure.ipynb b/ifrs17-template/Database/Configure.ipynb index b675f138..4ede3cfe 100644 --- a/ifrs17-template/Database/Configure.ipynb +++ b/ifrs17-template/Database/Configure.ipynb @@ -82,7 +82,7 @@ "source": [ "await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)", "\n .WithTypes(allTypes)", - "\n .WithMigration()", + "\n // .WithMigration() // uncomment if run with migration", "\n ) ", "\n .ConnectAsync();" ], From 3b39cf0d244691edbed166d6fd51d1399aa85fe8 Mon Sep 17 00:00:00 2001 From: akatz Date: Tue, 24 Jan 2023 09:54:05 +0100 Subject: [PATCH 06/16] explain --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index 91f29f93..e287c2ba 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -27,7 +27,7 @@ { "cell_type": "markdown", "source": [ - "With the migration, if there is a need to change the data base (DB), we do not remove the old DB, but rather migrate it incrementally.", + "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 adding a 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, 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 the account the snapshot of the previous step. The snapshot of the new scaffold should be copied manually without changes into the [Snapshot notebook](Snapshot)." ], From f2bc5c5f72b808d79e19b11240d08f4a54a7658c Mon Sep 17 00:00:00 2001 From: akatz Date: Tue, 24 Jan 2023 10:09:37 +0100 Subject: [PATCH 07/16] comments --- .../MigrationAndScaffolding/ReadMe.ipynb | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index e287c2ba..af0c3360 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -29,7 +29,29 @@ "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 adding a 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, 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 the account the snapshot of the previous step. The snapshot of the new scaffold should be copied manually without changes into the [Snapshot notebook](Snapshot)." + "\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 the 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 alrerady 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, From e8aac025a5b62a1ce5419769083a9c5f0e277275 Mon Sep 17 00:00:00 2001 From: akatz Date: Tue, 24 Jan 2023 10:19:59 +0100 Subject: [PATCH 08/16] All the comments added --- .../MigrationAndScaffolding/ReadMe.ipynb | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index af0c3360..dc024c2b 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -57,6 +57,53 @@ "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 iy your choice." + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "## Configure" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "Before you run 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 autmatically 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": [ From f1947f5fc16d3cea2aa0d0740fa0ffa5c7b6afd4 Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Wed, 8 Feb 2023 09:39:03 +0100 Subject: [PATCH 09/16] Update ReadMe.ipynb typo fixed --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index dc024c2b..9ba14b39 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -98,7 +98,7 @@ { "cell_type": "markdown", "source": [ - "Note, that when the schema is created, it is not filled autmatically 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 " + "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, @@ -114,4 +114,4 @@ "outputs": [] } ] -} \ No newline at end of file +} From 7bc4e73babd0ba4847c08a38f730e6ea321189ce Mon Sep 17 00:00:00 2001 From: akatz Date: Wed, 8 Feb 2023 12:13:53 +0100 Subject: [PATCH 10/16] address the comment --- .../MigrationAndScaffolding/Initial.ipynb | 2 +- .../MigrationAndScaffolding/Scaffold.ipynb | 15 +-- .../MigrationAndScaffolding/Snapshot.ipynb | 124 +++++++++--------- 3 files changed, 65 insertions(+), 76 deletions(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb index b46e31e9..3c2065a6 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb @@ -27,7 +27,7 @@ { "cell_type": "code", "source": [ - "[Migration(\"20230123152129_InitialTypes\")]", + "[Migration(\"20230208105811_InitialTypes\")]", "\npublic class InitialTypes : Migration", "\n{", "\n protected override void Up(MigrationBuilder migrationBuilder)", diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb index c755dde8..2a1151f2 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb @@ -32,18 +32,7 @@ "\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))", "\n && !t.IsInterface", "\n && !t.IsAbstract", - "\n );" - ], - "metadata": {}, - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "var allTypesFiltered = allTypes", - "\n .GroupBy(x => x.Name, (k, v) => v.OrderBy(y => Int32.Parse(y.DeclaringType.Name.Substring(11))).Last())", - "\n .ToArray();" + "\n ).ToArray();" ], "metadata": {}, "execution_count": 0, @@ -62,7 +51,7 @@ "cell_type": "code", "source": [ "var migration = SchemaMigrations", - "\n .ConfigureScaffolder(allTypesFiltered)", + "\n .ConfigureScaffolder(allTypes)", "\n .ForMsSql()", "\n .Scaffold(\"InitialTypes\");" ], diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb index 8b20cf6c..b4e6b8b2 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb @@ -41,7 +41,7 @@ "\n", "\n SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);", "\n", - "\n modelBuilder.Entity(\"Submission_150+YieldCurveReport\", b =>", + "\n modelBuilder.Entity(\"Submission_151+YieldCurveReport\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -70,7 +70,7 @@ "\n b.ToTable(\"YieldCurveReport\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_285+ImportExportActivity\", b =>", + "\n modelBuilder.Entity(\"Submission_287+ImportExportActivity\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -111,7 +111,7 @@ "\n b.ToTable(\"ImportExportActivity\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_287+ExportFile\", b =>", + "\n modelBuilder.Entity(\"Submission_289+ExportFile\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -140,7 +140,7 @@ "\n b.ToTable(\"ExportFile\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_289+ImportFile\", b =>", + "\n modelBuilder.Entity(\"Submission_291+ImportFile\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -178,7 +178,7 @@ "\n b.ToTable(\"ImportFile\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_290+ImportString\", b =>", + "\n modelBuilder.Entity(\"Submission_292+ImportString\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -204,7 +204,7 @@ "\n b.ToTable(\"ImportString\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_291+ImportDataSet\", b =>", + "\n modelBuilder.Entity(\"Submission_293+ImportDataSet\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -227,7 +227,7 @@ "\n b.ToTable(\"ImportDataSet\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_292+ImportStream\", b =>", + "\n modelBuilder.Entity(\"Submission_294+ImportStream\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -250,7 +250,7 @@ "\n b.ToTable(\"ImportStream\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_56+AmountType\", b =>", + "\n modelBuilder.Entity(\"Submission_57+AmountType\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -282,7 +282,7 @@ "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"AmountType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_58+RiskDriver\", b =>", + "\n modelBuilder.Entity(\"Submission_59+RiskDriver\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -302,7 +302,7 @@ "\n b.ToTable(\"RiskDriver\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_59+EstimateType\", b =>", + "\n modelBuilder.Entity(\"Submission_60+EstimateType\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -331,7 +331,7 @@ "\n b.ToTable(\"EstimateType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_60+Novelty\", b =>", + "\n modelBuilder.Entity(\"Submission_61+Novelty\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -348,7 +348,7 @@ "\n b.ToTable(\"Novelty\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_61+VariableType\", b =>", + "\n modelBuilder.Entity(\"Submission_62+VariableType\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -374,7 +374,7 @@ "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"VariableType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_67+Scenario\", b =>", + "\n modelBuilder.Entity(\"Submission_68+Scenario\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -388,7 +388,7 @@ "\n b.ToTable(\"Scenario\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_68+LineOfBusiness\", b =>", + "\n modelBuilder.Entity(\"Submission_69+LineOfBusiness\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -408,7 +408,7 @@ "\n b.ToTable(\"LineOfBusiness\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_69+Currency\", b =>", + "\n modelBuilder.Entity(\"Submission_70+Currency\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -422,7 +422,7 @@ "\n b.ToTable(\"Currency\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_70+EconomicBasis\", b =>", + "\n modelBuilder.Entity(\"Submission_71+EconomicBasis\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -436,7 +436,7 @@ "\n b.ToTable(\"EconomicBasis\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_71+ValuationApproach\", b =>", + "\n modelBuilder.Entity(\"Submission_72+ValuationApproach\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -450,7 +450,7 @@ "\n b.ToTable(\"ValuationApproach\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_72+LiabilityType\", b =>", + "\n modelBuilder.Entity(\"Submission_73+LiabilityType\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -467,7 +467,7 @@ "\n b.ToTable(\"LiabilityType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_73+OciType\", b =>", + "\n modelBuilder.Entity(\"Submission_74+OciType\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -481,7 +481,7 @@ "\n b.ToTable(\"OciType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_74+Profitability\", b =>", + "\n modelBuilder.Entity(\"Submission_75+Profitability\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -495,7 +495,7 @@ "\n b.ToTable(\"Profitability\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_75+Partner\", b =>", + "\n modelBuilder.Entity(\"Submission_76+Partner\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -509,7 +509,7 @@ "\n b.ToTable(\"Partner\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_76+CreditRiskRating\", b =>", + "\n modelBuilder.Entity(\"Submission_77+CreditRiskRating\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -523,7 +523,7 @@ "\n b.ToTable(\"CreditRiskRating\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_77+ReportingNode\", b =>", + "\n modelBuilder.Entity(\"Submission_78+ReportingNode\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -544,7 +544,7 @@ "\n b.ToTable(\"ReportingNode\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_78+ProjectionConfiguration\", b =>", + "\n modelBuilder.Entity(\"Submission_79+ProjectionConfiguration\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -564,7 +564,7 @@ "\n b.ToTable(\"ProjectionConfiguration\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_79+AocConfiguration\", b =>", + "\n modelBuilder.Entity(\"Submission_80+AocConfiguration\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -611,7 +611,7 @@ "\n b.ToTable(\"AocConfiguration\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_80+ExchangeRate\", b =>", + "\n modelBuilder.Entity(\"Submission_81+ExchangeRate\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -641,7 +641,7 @@ "\n b.ToTable(\"ExchangeRate\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_81+CreditDefaultRate\", b =>", + "\n modelBuilder.Entity(\"Submission_82+CreditDefaultRate\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -668,7 +668,7 @@ "\n b.ToTable(\"CreditDefaultRate\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_82+YieldCurve\", b =>", + "\n modelBuilder.Entity(\"Submission_83+YieldCurve\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -698,7 +698,7 @@ "\n b.ToTable(\"YieldCurve\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_83+PartnerRating\", b =>", + "\n modelBuilder.Entity(\"Submission_84+PartnerRating\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -726,7 +726,7 @@ "\n b.ToTable(\"PartnerRating\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_85+PartitionByReportingNode\", b =>", + "\n modelBuilder.Entity(\"Submission_86+PartitionByReportingNode\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -741,7 +741,7 @@ "\n b.ToTable(\"PartitionByReportingNode\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_86+PartitionByReportingNodeAndPeriod\", b =>", + "\n modelBuilder.Entity(\"Submission_87+PartitionByReportingNodeAndPeriod\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -765,7 +765,7 @@ "\n b.ToTable(\"PartitionByReportingNodeAndPeriod\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_87+DataNode\", b =>", + "\n modelBuilder.Entity(\"Submission_88+DataNode\", b =>", "\n {", "\n b.Property(\"SystemName\")", "\n .HasMaxLength(16)", @@ -804,7 +804,7 @@ "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"DataNode\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_91+DataNodeState\", b =>", + "\n modelBuilder.Entity(\"Submission_92+DataNodeState\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -834,7 +834,7 @@ "\n b.ToTable(\"DataNodeState\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_92+DataNodeParameter\", b =>", + "\n modelBuilder.Entity(\"Submission_93+DataNodeParameter\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -867,7 +867,7 @@ "\n b.HasDiscriminator(\"Discriminator\").HasValue(\"DataNodeParameter\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_97+RawVariable\", b =>", + "\n modelBuilder.Entity(\"Submission_98+RawVariable\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -902,7 +902,7 @@ "\n b.ToTable(\"RawVariable\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_98+IfrsVariable\", b =>", + "\n modelBuilder.Entity(\"Submission_99+IfrsVariable\", b =>", "\n {", "\n b.Property(\"Id\")", "\n .ValueGeneratedOnAdd()", @@ -940,51 +940,51 @@ "\n b.ToTable(\"IfrsVariable\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_57+DeferrableAmountType\", b =>", + "\n modelBuilder.Entity(\"Submission_58+DeferrableAmountType\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_56+AmountType\");", + "\n b.HasBaseType(\"Submission_57+AmountType\");", "\n", "\n b.HasDiscriminator().HasValue(\"DeferrableAmountType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_62+AocType\", b =>", + "\n modelBuilder.Entity(\"Submission_63+AocType\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n b.HasBaseType(\"Submission_62+VariableType\");", "\n", "\n b.HasDiscriminator().HasValue(\"AocType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_64+PnlVariableType\", b =>", + "\n modelBuilder.Entity(\"Submission_65+PnlVariableType\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n b.HasBaseType(\"Submission_62+VariableType\");", "\n", "\n b.HasDiscriminator().HasValue(\"PnlVariableType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_65+BsVariableType\", b =>", + "\n modelBuilder.Entity(\"Submission_66+BsVariableType\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n b.HasBaseType(\"Submission_62+VariableType\");", "\n", "\n b.HasDiscriminator().HasValue(\"BsVariableType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_66+AccountingVariableType\", b =>", + "\n modelBuilder.Entity(\"Submission_67+AccountingVariableType\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_61+VariableType\");", + "\n b.HasBaseType(\"Submission_62+VariableType\");", "\n", "\n b.HasDiscriminator().HasValue(\"AccountingVariableType\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_88+Portfolio\", b =>", + "\n modelBuilder.Entity(\"Submission_89+Portfolio\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_87+DataNode\");", + "\n b.HasBaseType(\"Submission_88+DataNode\");", "\n", "\n b.HasDiscriminator().HasValue(\"Portfolio\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_89+GroupOfContract\", b =>", + "\n modelBuilder.Entity(\"Submission_90+GroupOfContract\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_87+DataNode\");", + "\n b.HasBaseType(\"Submission_88+DataNode\");", "\n", "\n b.Property(\"AnnualCohort\")", "\n .HasColumnType(\"int\");", @@ -1008,9 +1008,9 @@ "\n b.HasDiscriminator().HasValue(\"GroupOfContract\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_93+InterDataNodeParameter\", b =>", + "\n modelBuilder.Entity(\"Submission_94+InterDataNodeParameter\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_92+DataNodeParameter\");", + "\n b.HasBaseType(\"Submission_93+DataNodeParameter\");", "\n", "\n b.Property(\"LinkedDataNode\")", "\n .IsRequired()", @@ -1022,9 +1022,9 @@ "\n b.HasDiscriminator().HasValue(\"InterDataNodeParameter\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_93+SingleDataNodeParameter\", b =>", + "\n modelBuilder.Entity(\"Submission_94+SingleDataNodeParameter\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_92+DataNodeParameter\");", + "\n b.HasBaseType(\"Submission_93+DataNodeParameter\");", "\n", "\n b.Property(\"PremiumAllocation\")", "\n .HasColumnType(\"float\");", @@ -1032,30 +1032,30 @@ "\n b.HasDiscriminator().HasValue(\"SingleDataNodeParameter\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_88+InsurancePortfolio\", b =>", + "\n modelBuilder.Entity(\"Submission_89+InsurancePortfolio\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_88+Portfolio\");", + "\n b.HasBaseType(\"Submission_89+Portfolio\");", "\n", "\n b.HasDiscriminator().HasValue(\"InsurancePortfolio\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_88+ReinsurancePortfolio\", b =>", + "\n modelBuilder.Entity(\"Submission_89+ReinsurancePortfolio\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_88+Portfolio\");", + "\n b.HasBaseType(\"Submission_89+Portfolio\");", "\n", "\n b.HasDiscriminator().HasValue(\"ReinsurancePortfolio\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_90+GroupOfInsuranceContract\", b =>", + "\n modelBuilder.Entity(\"Submission_91+GroupOfInsuranceContract\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_89+GroupOfContract\");", + "\n b.HasBaseType(\"Submission_90+GroupOfContract\");", "\n", "\n b.HasDiscriminator().HasValue(\"GroupOfInsuranceContract\");", "\n });", "\n", - "\n modelBuilder.Entity(\"Submission_90+GroupOfReinsuranceContract\", b =>", + "\n modelBuilder.Entity(\"Submission_91+GroupOfReinsuranceContract\", b =>", "\n {", - "\n b.HasBaseType(\"Submission_89+GroupOfContract\");", + "\n b.HasBaseType(\"Submission_90+GroupOfContract\");", "\n", "\n b.HasDiscriminator().HasValue(\"GroupOfReinsuranceContract\");", "\n });", From 914cd658436d9783ec71e4bba480a3e1a3e3a141 Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:21:17 +0100 Subject: [PATCH 11/16] Update ReadMe.ipynb comments resolved --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index 9ba14b39..cec60f87 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -27,7 +27,7 @@ { "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 adding a 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. ", + "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 the 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 alrerady for the initial migration, please do not forget to change the [Snapshot notebook](Snapshot) for any subsequent migration.", "\n", From 172ec530bc5bd185b7e6fc240fb473a7730e02ee Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:25:40 +0100 Subject: [PATCH 12/16] Update ReadMe.ipynb typos fixed --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index cec60f87..72781a25 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -29,7 +29,7 @@ "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 the 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 alrerady for the initial migration, please do not forget to change the [Snapshot notebook](Snapshot) for any subsequent migration.", + "\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", From 2f6764c7beefd6f627535a42f3512ea4355ce8fb Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:29:07 +0100 Subject: [PATCH 13/16] Update ReadMe.ipynb typo --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index 72781a25..b5973339 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -62,7 +62,7 @@ "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 iy your choice." + "\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, From 3c7953748cf5af1ae5093c3662f47d0df10aba5f Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:33:33 +0100 Subject: [PATCH 14/16] Update ReadMe.ipynb wording change --- ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index b5973339..4df659cd 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -80,7 +80,7 @@ { "cell_type": "markdown", "source": [ - "Before you run the [Configure notebook](../Configure), please uncomment the row, that specifies that the Configuration is run with migration. " + "Before you execute the [Configure notebook](../Configure), please uncomment the row, that specifies that the Configuration is run with migration. " ], "metadata": {}, "execution_count": 0, From dca2b28c840a6a315019da943a26d985fd496538 Mon Sep 17 00:00:00 2001 From: Andrey Katz <118806207+andrey-katz-systemorph@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:35:04 +0100 Subject: [PATCH 15/16] Update Scaffold.ipynb wording --- .../Database/MigrationAndScaffolding/Scaffold.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb index 2a1151f2..ade2fb00 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb @@ -62,7 +62,7 @@ { "cell_type": "markdown", "source": [ - "In order to perform any subsequent change in the DB, there is no need to erase the DB and create 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." + "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." ], "metadata": {}, "execution_count": 0, @@ -109,4 +109,4 @@ "outputs": [] } ] -} \ No newline at end of file +} From ccd46717dd46fa643b7cb53e5023326aaf07553d Mon Sep 17 00:00:00 2001 From: akatz Date: Thu, 9 Feb 2023 15:36:24 +0100 Subject: [PATCH 16/16] Title and some minor explanations added --- .../MigrationAndScaffolding/Initial.ipynb | 9 ++++++++ .../MigrationFlow.ipynb | 9 ++++++++ .../MigrationAndScaffolding/ReadMe.ipynb | 11 +++++++++- .../MigrationAndScaffolding/Scaffold.ipynb | 22 +++++++++++++++++-- .../MigrationAndScaffolding/Snapshot.ipynb | 9 ++++++++ 5 files changed, 57 insertions(+), 3 deletions(-) diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb index 3c2065a6..e14369ba 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "markdown", + "source": [ + "

The Initial Migration Code

" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ diff --git a/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb index 62b0863c..99310591 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/MigrationFlow.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "markdown", + "source": [ + "

Migration Flow

" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ diff --git a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb index 4df659cd..afde3c4f 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "markdown", + "source": [ + "

Explanation of Migration and Scaffolding

" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [ @@ -114,4 +123,4 @@ "outputs": [] } ] -} +} \ No newline at end of file diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb index ade2fb00..103c03ac 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Scaffold.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "markdown", + "source": [ + "

Scaffolding

" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ @@ -25,6 +34,15 @@ "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": [ @@ -62,7 +80,7 @@ { "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." + "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, @@ -109,4 +127,4 @@ "outputs": [] } ] -} +} \ No newline at end of file diff --git a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb index b4e6b8b2..4f7e598d 100644 --- a/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb +++ b/ifrs17-template/Database/MigrationAndScaffolding/Snapshot.ipynb @@ -15,6 +15,15 @@ "nbformat": 4, "nbformat_minor": 5, "cells": [ + { + "cell_type": "markdown", + "source": [ + "

The Current Snapshot

" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "markdown", "source": [