In Migration we have two type of migration
- Automated Migration
- Code-based Migration
Below information’s are for Code-based Migration
Enable-Migrations: Enables the migration in your project by creating a Configuration class.PM> Enable-Migrations
Add-Migration: Creates a new migration class as per specified name with the Up() and Down() methods.PM> Add-Migration
"MigrationName"
The above command will create a “timestamp_MigrationName”.cs file with the Up() and Down() methods
Update-Database: Executes the last migration file created by the Add-Migration command and applies changes to the database schema.PM> Update-Database
Rollback Migration to previous onePM> update-database -TargetMigration:"timestamp_MigrationName
“