question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migration failed to add a field to the CatalogItem entity in CatalogContext of Catalog.API

See original GitHub issue

1.First, I added a String field: Tests

public string Tests { get; set; }

2.Then, to perform the migration:

 add - migration AddTests - c CatalogContext - o Infrastructure/CatalogMigrations

3.Finally, execute the project(or update-database) and report an error

image


After Debugging the source code, I found that the last migration record was not synchronized into the model snapshot.

This submission record has been modified. (https://github.com/dotnet-architecture/eShopOnContainers/commit/45ed8a60ad87c0da8f84f93aae143dce7e9c8bcc) But the snapshot file has not changed. (https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Catalog/Catalog.API/Infrastructure/CatalogMigrations/CatalogContextModelSnapshot.cs)

Causes new fields to be added to conflict.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
anjoy8commented, Nov 16, 2020

Hi, I had intended to submit two PRs, but eventually merge together, https://github.com/dotnet-architecture/eShopOnContainers/pull/1520 I wonder if this meets your requirements.

In addition, there may still be some problems about Seed data, and I will further study it.

1reaction
anjoy8commented, Nov 16, 2020

Hi, @sughosneo nice to hear from you again.

Regarding my issue, only need to modify the model snapshot.

On the issue of the (https://github.com/dotnet-architecture/eShopOnContainers/issues/1350), I have found the problem, do I need to submit a PR?

图片

Just change pictureFileName to lowercase.

pictureFileName -> picturefilename

need I need to submit a PR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate order and order product fields [#3165421]
Problem/Motivation Running the migration using Migrate Upgrade, using core 8.9.3, the latest Commerce and all dependencies, it fails with ...
Read more >
Work with data in ASP.NET Core Apps
NET Core supports various data access options, including Entity Framework Core (and Entity Framework 6 as well), and can work with any ....
Read more >
Service Catalog API
The Service Catalog API provides endpoints that access Service Catalog configuration and actions from within ... Add a field to the service catalog...
Read more >
Distributed transaction using SAGA pattern, RabbitMQ and ...
Distributed transaction is one that spans multiple databases across the network while preserving ACID properties.
Read more >
Errors during Code First add-migration
Our add-migrations are failing routinely but not consistently. The migration always gets to the scaffolding step and then roughly 4 out of 5 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found