Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions PresentValueSeries/InitializeData.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "HSWSJivQ9Uq-k7P9Ky6MAg",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False",
"toc-showtags": "False"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
Expand Down Expand Up @@ -108,4 +105,4 @@
"outputs": []
}
]
}
}
9 changes: 3 additions & 6 deletions PresentValueSeries/PresentValue - Episode 2.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "HmaHGel-LEeFl0jOhE9pPw",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False",
"toc-showtags": "False"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
Expand Down
9 changes: 3 additions & 6 deletions PresentValueSeries/PresentValue - Episode 3.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "UQV1FkirrkmGCOCfpHVsEA",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -10,14 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False",
"toc-showtags": "False"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
Expand Down
3 changes: 2 additions & 1 deletion PresentValueSeries/Test.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "t7h_PHrvb0GNmLCXuxb1kg",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -13,7 +14,7 @@
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
Expand Down
5 changes: 3 additions & 2 deletions ifrs17-template/Constants/CalculationEngine.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "ORrEbLR_T0C1aoQoVcXCpA",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -13,13 +14,13 @@
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "code",
"source": [
"var projectName = \"ifrs17\";",
"\nvar environmentName = \"v1.1.1\";",
"\nvar environmentName = \"v1.2.0\";",
"\nvar notebookName = \"CalculationEngine\";",
"\nvar calculationEngine = $\"#!import \\\"//{projectName}/{environmentName}/{notebookName}\\\"\";"
],
Expand Down
13 changes: 7 additions & 6 deletions ifrs17-template/Database/Configure.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"authors": [],
"id": "NKif7XZ_00aa5ksgQlE6_g",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
Expand All @@ -10,13 +11,10 @@
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
},
"toc-autonumbering": "True",
"toc-showcode": "False",
"toc-showmarkdowntxt": "False"
}
},
"nbformat": 4,
"nbformat_minor": 5,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
Expand Down Expand Up @@ -81,7 +79,10 @@
"cell_type": "code",
"source": [
"await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
"\n .WithTypes(allTypes)) .ConnectAsync();"
"\n .WithTypes(allTypes)",
"\n // .WithMigration() // uncomment if run with migration",
"\n ) ",
"\n .ConnectAsync();"
],
"metadata": {},
"execution_count": 0,
Expand Down
729 changes: 729 additions & 0 deletions ifrs17-template/Database/MigrationAndScaffolding/Initial.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"metadata": {
"authors": [],
"id": "oPiKSNUZMki5wrdUJlHjPQ",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
}
},
"nbformat": 4,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
"source": [
"<p style=\"font-weight:bold;\"> <span style=\"font-size: 36px\"> Migration Flow </span> </p>"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"#r \"nuget:Systemorph.SchemaMigrations,1.6.3\"",
"\n#!import \"../PersonalConnectionExample\""
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"For the initial migration one needs a migration code from the Initial notebook, so we import it here. For any subsequent migrations please change the next cell to import the notebook, where your stored the relevant migration code."
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"#!import \"Initial\""
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Here is the migration of the data base. For all subsequent migrations, please replace the InitialTypes in the second row with the name, that you gave to your migration. "
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"source": [
"await SchemaMigrations",
"\n .Apply<InitialTypes>() // 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": []
}
]
}
127 changes: 127 additions & 0 deletions ifrs17-template/Database/MigrationAndScaffolding/ReadMe.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"metadata": {
"authors": [],
"id": "bq9bMSDFR02hhSb_XpjkBQ",
"kernelspec": {
"display_name": "Formula Framework",
"language": "C#",
"name": "C#"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/plain",
"name": "C#"
}
},
"nbformat": 4,
"nbformat_minor": 8,
"cells": [
{
"cell_type": "markdown",
"source": [
"<p style=\"font-weight:bold;\"> <span style=\"font-size: 36px\"> Explanation of Migration and Scaffolding </span> </p>"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# Brief Explanation of Migration"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Migration is a powerful tool that allows us to keep the same Database (DB) during the whole lifetime of the project, without any need to remove it if one needs to modify the DB, e.g. via addition or removing certain tables or columns. With the migration, if modification of the DB is needed, we do not remove the old DB, but rather migrate it incrementally. Note, however, that running a project with migration is a choice rather than a default option. If you are OK with removing the DB each time when some change in the tables structure is needed, migration is not necessary. ",
"\n",
"\nAt the first step we perform the [scaffolding](Scaffold). The scaffolding procedure naturally outputs the migration code and the model snapshot. The migration code is the code that we should run in order to change the DB according to our new requirements, or, alternatively, if we start from scratch, to create the DB. The snapshot contains all the information about the structure of the DB after the migration. It is necessary to have the snapshot, in order for us not to start from scratch at the next migration, but rather only *implement the changes*. Each time when the DB has to be changed, we should scaffold the new model, taking into account the snapshot of the previous step. The snapshot of the new scaffold should be copied manually without changes into the [Snapshot notebook](Snapshot). We have done it already for the initial migration, please do not forget to change the [Snapshot notebook](Snapshot) for any subsequent migration.",
"\n",
"\nAt the next step the migration code should be copied into a new notebook. The first one was copied into the [Initial notebook](Initial). Of course, it would make a lot of sense to add each new incremental migration into a new notebook inside this folder. ",
"\n",
"\nFinally, in order to update or initiate the DB, one should run the [Migration flow notebook](MigrationFlow) where we feed all the necessary information from the [personal connection](../PersonalConnectionExample) and the notebook that includes the migration code, which is the [Initial notebook](Initial) for the first migration. "
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"# A Handful of Comments on Migration"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Do Not Delete "
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Since the logic migration includes incremental changes, while adding or removing something from the DB, one should not delete the schema anymore. Therefore, the [schema deletion notebook](../SchemaDelete) must not be used. ",
"\n",
"\nSince migration is not a default mode, we are still leaving this notebook in the folder. However, note that now using it would contradict the logic of migration, so please do not do it light-headedly. Stick to migration if this is your choice."
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Configure"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Before you execute the [Configure notebook](../Configure), please uncomment the row, that specifies that the Configuration is run with migration. "
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Initialize"
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Note, that when the schema is created, it is not filled automatically via running the [Configure](../Configure) notebook. Therefore there is a need to initaliaze the DB manually via [this](../../Initialization/InitSystemorphToDatabase) notebook. Otherwise you will get a correctly structured, but completely empty DB "
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
""
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
Loading