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?
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.
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.