38 lines
1.0 KiB
Markdown
38 lines
1.0 KiB
Markdown
|
|
# Entity Framework Core - Datenbank Migrationen und Updates
|
|
|
|
## EF Tools installieren/aktualisieren
|
|
```
|
|
dotnet tool update --global dotnet-ef --version 9.0.11
|
|
```
|
|
|
|
## Update-DB:
|
|
create migrations and update database for both DbContexts
|
|
|
|
### AppDbContext
|
|
create migrations for AppDbContext
|
|
```
|
|
dotnet ef migrations add [Initial_App] --project src/Koogle.Infrastructure --startup-project src/Koogle.Web --context AppDbContext --output-dir Data/Migrations
|
|
```
|
|
update database:
|
|
```
|
|
dotnet ef database update -p src/Koogle.Infrastructure -s src/Koogle.Web --context AppDbContext
|
|
```
|
|
|
|
### AppIdentityDbContext
|
|
create migrations for AppIdentityDbContext:
|
|
```
|
|
dotnet ef migrations add [Initial_Auth] --project src/Koogle.Infrastructure --startup-project src/Koogle.Web --context AppIdentityDbContext --output-dir Identity/Migrations
|
|
```
|
|
update database:
|
|
```
|
|
dotnet ef database update -p src/Koogle.Infrastructure -s src/Koogle.Web --context AppIdentityDbContext
|
|
```
|
|
|
|
|
|
# Tests
|
|
|
|
## Tests ausführen
|
|
```
|
|
dotnet test tests/Koogle.Application.Tests
|
|
``` |