EF Code First Drop Database?

I want to use the first migrations of EF code to create my models in a database. However, the database that I will use already exists and is used by other applications. My question is:

Are migrations removed from the database? That would be a disaster! Does migration eliminate anything at all?

+4
source share
2 answers

Q: Are migrations removed from the database?

A: No. You can do this without erasing it.

You must do this as shown below in the Package Manager console .

Step 1:

PM > Add-Migration InitialCreate –IgnoreChanges

The above command will create an empty migration with the current model as a snapshot.

Step 2:

PM > Update-Database

InitialCreate . , , __MigrationsHistory, , .

: CF

+1

, , - , Up Down . , , , , , , .

0

Source: https://habr.com/ru/post/1660722/


All Articles