I am trying to migrate the database, and there is an issue I can't solve. Basically I have to migrate also the existing migrations which are bound to Mysql implementation. Here is one example of the problem:
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
},
"MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn"
In each migration the same problem throws error and I couln't find in any documentation how do I change this for Postgre. I guess this specifies the Primary Key autogeneration method.
PS This is the thrown error, because I switched from Pomelo.Mysql to npg.Postgre database provider for ef core:
Error CS0103 The name 'MySqlValueGenerationStrategy' does not exist in the current context BingoAPI D:\Bingo\BingoAPI\Migrations\20200420230201_IdentityUser.cs 76 Active
Ok, I figured out an easier way, all migrations including the DataContextModelSnapshot has to be deleted and then a new migration has to be done but, this is only in the case when you want to migrate the schema but not including the data, that has to be done manually
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.