Me and a friend are working on an ASP.NET Core project as teammate and sharing data using github, every time who pull changes from github, should delete the Migration folder
in order to add migrations without getting any errors, otherwise, we get the following error:
There is already an object named AspNetRoles in the database. (entity-framework-core)
So we should delete Migrations Folder
and commenting the infos out inside the Up
methode after every pulling to get rid of this error when doing migrations.
Now Assume that I alredy have a table named Product.cs
that has two property as follows:
public class Product
{
[Key]
public int ProductId { get; set; }
[Display(Name = " date ")]
public DateTime CreateDate { get; set; }
and then my friend decide to add new Prop
into Product.cs
(for example: public DateTime Count { get; set; }
), Now when I pull the changes from github
(after deleting Migrations Folder), I do new migrations again, but now the entity 'Product.cs' doesn't contain any column named Count
in SSMS
, So What should I do to have the new done changes in my tables in my data base
?
There is already an object named AspNetRoles in the database. (entity-framework-core)
without delete the Migration folder.You can have a try. – Euchromatin