This writeup will provide you insights into the database migration command which is crucial for the code first approach using two methods: the Windows CLI and Visual Studio Package manager console.
Method 1- Using Package Manager
Adding Migration
add-migration FirstMigration
Updating database with latest changes of database script
Update-database
Removing the migration-it removes the last migration
remove-migration
Drop database
drop-database
Generating SQL Script
script-migration
Method 2- Using Windows CLI
Adding Migration
dotnet ef migrations add FirstMigration
Updating database with latest changes of database script
dotnet ef database update
Removing the migration
dotnet ef migrations remove
Dropping database
dotnet ef drop database
Generating SQL Script
dotnet ef migration script
To recapitulate, we have learned the most important and common command for database migration code first approach. I hope, it will be helpful for you to utilize it especially; if your project is based on the code first approach.