amiry jd
amiry jd

Reputation: 27603

how to use ef migration to create database?

I googled migration tutorials. In all af them, first run the application to create database by ef, then enable migration! Is there a way to create database with migration? not with runing the application? I try these:

Add-Migration CustomName // not works

Add-Migration $InitialDatabase // not works

Add-Migration InitialDatabase // not works

Add-Migration InitialCreate // not works

Update-Database // not works

Update-Database Update-Database –TargetMigration:$InitialDatabase // not works

Upvotes: 2

Views: 3909

Answers (1)

Anders Abel
Anders Abel

Reputation: 69280

If you have everything correctly setup (connection string, having run enable-migrations) then you should be able to run update-database at the package manager console to get the database created.

The $InitialDatabase is a special migration step that's automatically created. You should never try to add a new migration step with that name.

Upvotes: 1

Related Questions