currently I'm using MYSQL 2019 (EF 3.1)and Visual Studio 2019 ASP . Net Core 3.1 version.
This is my model:
public class User { public int Id { get; set; } \[Required\] public string Username { get; set; } \[Required\] public string Password { get; set; } public string Email { get; set; } public string Address { get; set; } \[Required\] public DateTime DateCreated { get; set; } \[Required\] public DateTime DateUpdated { get; set; } public bool IsAdmin { get; set; } }I made a mistake, I didn't notice at the moment that I have two migrations for the same property(DateUpdated),and now I can't do new migration.
This is my fourth migration:
protected override void Up(Migration Builder migrationBuilder) { migrationBuilder.AddColumn<DateTime>( name: "DateUpdated", table: "MyBlog", nullable: true); }
protected override void Down(Migration Builder migration Builder) { migrationBuilder.DropColumn( name: "DateUpdated", table: "MyBlog"); }and тhis is my seventh migration:
protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<DateTime>( name: "DateUpdated", table: "Users", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn\<bool\>( name: "IsAdmin", table: "Users", nullable: false, defaultValue: false); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "DateUpdated", table: "Users"); migrationBuilder.DropColumn( name: "IsAdmin", table: "Users"); }.
It gives me this error:
Error Number:2705,State:4,Class:16
Column names in each table must be unique. Column name 'Date Updated' in table 'Users' is specified more than once.
I understand where my mistake is, but how can I solve this?