EF 4.3 Database Migration Commands Cheatsheet

Code-Based Migrations

Original: http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx

Enable-Migrations
Add-Migration – scaffold next migration based on changes made to the model.
Update-Database – update database model to the latest migration model
Update-Database -Verbose – update database model and output SQL generated
Update-Database -TargetMigration: “someMigration” – update database up (or down) to a “revision”
Update-Database -Script -SourceMigration:$InitialDatabase -TargetMigration:”AddPostAbstract” Generate SQL script of the migrations
SQL(“update sometable set somefield=’hi'”) – can insert custom SQL into migration class.

Automatic Migrations

Original here: http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-automatic-migrations-walkthrough.aspx

Enable-Migrations -EnableAutomaticMigrations -Force – turn on automatic migrations

Basically does the same as code-based migrations, but before doing Database-update it automatically calls Add-Migration and gives it a name.