836 B
836 B
Database Setup and Migration Guide
Prerequisites
- .NET 8.0 SDK
- Entity Framework Core tools
Install EF Core Tools
dotnet tool install --global dotnet-ef
Creating and Updating Database
-
Create initial migration: dotnet ef migrations add InitialCreate
-
Apply migrations to create/update database: dotnet ef database update
Common Commands
-
Create new migration: dotnet ef migrations add
-
Remove last migration: dotnet ef migrations remove
-
Apply migrations to create/update database: dotnet ef database update
-
Revert last migration: dotnet ef database update
-
List all migrations: dotnet ef migrations list
-
Script migration: dotnet ef migrations script
-
Remove all migrations: dotnet ef migrations remove
-
Drop database: dotnet ef database drop