P
P
Paul Fawkes2019-06-08 14:59:37
visual studio
Paul Fawkes, 2019-06-08 14:59:37

Database migration, how to implement it?

I work with mvc, I connected the database in the console, I wrote:
cd "path"
dotnet ef migration add "name"
dotnet ef database update "name" the database
was created according to my model, then I want to add new fields and how can I update the database ??? I understand that you need to delete old migrations and databases and do everything again?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Filatov, 2019-06-08
@NYMEZIDE

You don't need to delete anything.
1. make changes to the EF models
2. dotnet ef migration add "name2"
3. dotnet ef database update
The third command will roll up all the migrations that have not yet been applied.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question