Scaffolding - There is already an object named 'entity_name' in the database.
See original GitHub issueHi,
I read though the documentation in https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/ and created a code first initial migration using PowerShell command (Add-Migration). This step generated three files -
- TimeStamp_Initial.cs
- TimeStamp_Initial.Designer.cs
- DbContextModelSnapshot.cs
I was able to successfully apply the migration to the database. Then I added a new entity and tried generating another migration. This step updated the DbContextModelSnapshot.cs file and produced two new files -
- TimeStamp_Update.cs
- TimeStamp_Update.Designer.cs
I then tried to apply the migrations but received an error. When I looked at the Up method in TimeStamp_Update.cs, I see the newly added table along with existing (all) tables that we created in the initial migration. Is this the expected behavior? Should I be manually removing the tables that are already existing in the database from the Up method? May be I’m missing something, kindly guide…
Exception message: There is already an object named 'entity_name' in the database.
Further technical details
EF Core version: 2.0.2
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.6.6
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (3 by maintainers)
I figured out the issue… Closing 😃
@ruwentos This is a closed issue. If you’re hitting an issue, then please open a new issue and attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.