diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1cac1b0..7be6469 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,12 +2,18 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile { "name": "Existing Dockerfile", + "onCreateCommand": "dotnet tool install --global dotnet-ef --version 9.0.7", "build": { // Sets the run context to one level up instead of the .devcontainer folder. "context": "..", // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. "dockerfile": "../KarateDockerfile" }, + "features": { + "ghcr.io/devcontainers/features/dotnet:2": { + "version": "9.0.303" + } + }, "runArgs": [ "--network=host" ], diff --git a/README.md b/README.md index e47e48e..61eb5c2 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ ## Migrations -### Adding a new migration (Windows via Visual Studio) +### Adding a new migration -Run the database using doocker compose executing the following script +Run the database using docker compose executing the following script ```bash docker compose --profile db-only up -d ``` +#### Visual Studio After making changes to the model and AppDbContext open Tools -> NuGet Package Manager -> Package Manager Console Execute the following with your migration name @@ -20,3 +21,17 @@ To apply migration run the following: ```bash Update-Database -Project Application ``` + +#### VS Code + +Open project in the devcontainer and open Terminal -> New Terminal + +Execute the following with your migration name +```bash +dotnet ef migrations add --startup-project Api/ --project Application/ -- --environment MockForDevelopment +``` + +To apply migration run the following: +```bash +dotnet ef database update --startup-project Api/ --project Application/ -- --environment MockForDevelopment +```