Is there a way to ensure db migrations in entity framework core?

191 Views Asked by At

Is there a way similar to Database.EncureCreated() method to ensure all migrations were executed from the app?

1

There are 1 best solutions below

0
On

You can use Database.Migrate() - REF

From the article:

Applies any pending migrations for the context to the database. Will create the database if it does not already exist.

Note that Database.Migrate() is mutually exclusive with Database.EnsureCreated()