Efcore: Add-Migrations missing -IgnoreChanges

Created on 2 Mar 2018  路  3Comments  路  Source: dotnet/efcore

I have extracted an existing MySql database from a remote server following following Getting Started with EF Core on ASP.NET Core with an Existing Database

I am using EF Core 2.0 and EF Core Tools using VS 2017 on Windows.

I am now trying to add a table to this database following Migrations.

When I run
Add-Migration InitialExpanse
I get the error
Table 'already_existing_table' already exists
but

Add-Migration InitialExpanse -IgnoreChanges
Add-Migration : A parameter cannot be found that matches parameter name 'IgnoreChanges'.
At line:1 char:30
+ Add-Migration InitialExpanse -IgnoreChanges
+                              ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Add-Migration], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Add-Migration

How do I deal with this issue?

closed-duplicate

Most helpful comment

Okay, I have a workaround by commenting out the relevant code in the Up and Down methods in the migration. But -IgnoreChanges would be nice for capturing existing state from an already existing database.

All 3 comments

Okay, I have a workaround by commenting out the relevant code in the Up and Down methods in the migration. But -IgnoreChanges would be nice for capturing existing state from an already existing database.

Possibly covered by #2167

Just a note that 12/10/2018 -IgnoreChanges does not seem to work yet (i could be doing something wrong). But was following (basically) https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/existing-database which indicates to use -IgnoreChanges

If it helps anyone, commenting out the code INSIDE the up method and running update-database eventually can get the EF process into "sync" and then you can go from there. At least in Dev.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

obelixA picture obelixA  路  105Comments

JocaPC picture JocaPC  路  77Comments

divega picture divega  路  100Comments

econner20 picture econner20  路  97Comments

divega picture divega  路  146Comments