Using the EF Core 8 command line utility to remove a seed data migration, I get this error:
Unable to create a ‘DbContext’ of type ‘MyDbContext’. The exception ‘The seed entity for entity type ‘User’ cannot be added because a default value was provided for the required property ‘Id’. Please provide a value different from ‘00000000-0000-0000-0000-000000000000′.’ was thrown while attempting to create an instance.
However it allowed me to Add-Migration just fine.
My (messed up) migration:
public partial class TestUserData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "Users",
columns: new[] { "Id", "AdFreePeriodStartedOn", "Email", "RemainingLLMTokens", "RemainingLikes", "RemainingMatchOptions", "RemainingSuperLikes", "UserName", "Address" },
values: new object[] { new Guid("0001c288-26e8-4926-852f-300408706319"), null, "VALID EMAIL", 0, 0, 0, 0, "TestUser", null });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Users",
keyColumn: "Id",
keyValue: new Guid("0001c288-26e8-4926-852f-300408706319"));
}
}
How do I remove this stuck migration with incorrect seed data?
0