...see more

Instruct EF Core to create a migration named InitialCreate:

Add-Migration InitialCreate

EF Core will create a directory called Migrations in your project, and generate some files. It's a good idea to inspect what exactly EF Core generated - and possibly amend it - but we'll skip over that for now.

...see more

Create a database and create your schema from the migration. This can be done via the following:

Update-Database

That's all there is to it - your application is ready to run on your new database, and you didn't need to write a single line of SQL. Note that this way of applying migrations is ideal for local development, but is less suitable for production environments - see the Applying Migrations page for more info.

...see more

You can list all existing migrations as follows:

Get-Migration
...see more

You can remove the latest migration with the following command:

Remove-Migration

Comments

Leave a Comment

All fields are required. Your email address will not be published.