0

I add a new migration to my solution , and when trying to update database using this command

Update-Database 

there is an error message shown

There is already an object named 'Currency' in the database

I'm using Entity Framework Core 2.0

1 Answer 1

2

As error says

Someone added already added an object Currency in DB

Seems there is a problem in migration process.

You can try following solution if they helps.

Run add-migration command in "Package Manager Console":

Add-Migration First -IgnoreChanges

do some changes, and then update database from "Initial" file:

Update-Database -verbose

If you are working on a Team Project. I will suggest you to set AutomaticMigrationsEnabled to false

AutomaticMigrationsEnabled = false;

It will ensure unpredictable migrations and make sure that every developer on the team works with the same data base structure.

You can also try

Update-Database -Script for update a database manually. And you can exclude 'Currency' from resulting script

Sign up to request clarification or add additional context in comments.

3 Comments

Add-Migration : A parameter cannot be found that matches parameter name 'IgnoreChanges'. At line:1 char:23 + Add-Migration Initial -IgnoreChanges + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Add-Migration], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Add-Migration
try Executing Add-Migration First -IgnoreChanges
Try Update-Database -Script for update a database manually. And you can exclude 'Currency' from resulting script

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.