
**Comment out post build scripts before!!!**
[DB Migration](https://learn.microsoft.com/en-us/ef/core/cli/dotnet)

**list installed dotnet tools**
dotnet tool list --local

**make sure that tool is installed =>** 

dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local dotnet-ef --version 6.0.23

**if you have no permissions disable the novus nuget**

**!!! make sure that folder structure Db/SqLite exists !!!!!!**

PM> NuGet\Install-Package Microsoft.EntityFrameworkCore.Tools -Version 6.0.23

## Open Developer Power Shell

**Under Menue => (View -> Terminal)** 

**-------- !!!!! IMPORTANT INFO !!!!!! --------**
Before starting the Migration scripts COMMENT OUT the bost build scripts

### Powershell commands for migrating user authentication application context

**for executing the 'dotnet ef migrations' command delete the 'xxx_InitialCreate.cs' and 'xxxModelSnapshot.cs' files**

dotnet ef migrations add InitialCreate --project SelmoStudio.Hmi.Server --context AuthenticationDbContext

dotnet ef database update --project SelmoStudio.Hmi.Server --context AuthenticationDbContext

### Powershell commands for migrating process value application context

**for executing the 'dotnet ef migrations' command delete the 'xxx_InitialCreate.cs' and 'xxxModelSnapshot.cs' files**

dotnet ef migrations add InitialCreate --project SelmoStudio.Hmi.Server --context ProcessValueDbContext

dotnet ef database update --project SelmoStudio.Hmi.Server --context ProcessValueDbContext

**DONT FORGET TO Comment in post build scripts after**
**DONT FORGET TO disable the novus nuget**


[Doku more detailed](https://dev.azure.com/SelmoDev/Selmo/_wiki/wikis/Selmo.wiki/574/Entity-Framework-migration)
