0
SBJ created
- What is your product version? 8.7.0.
- What is your product type (Angular or MVC)? MVC
- What is product framework type (.net framework or .net core)? .NET Core
Hi,
All our migration files are working fine. However, after adding the most recent one, the tenant screen pops up with internal server error and doesn't create the tenant. It crashes and throws an exception at this place (added try-catch myself):
try {
// Create Tenant DB
_abpZeroDbMigrator.CreateOrMigrateForTenant(tenant);
}
catch (Exception ex)
{
throw ex;
}
The error is as follows:
But I cannot find anything identifier related? All the entities in the DbContext are properties instead of fields and they all have a primary key with uniqueidentifier, so what is the identifier that it is whining about here?
This is the most recent migration that I added:
public partial class Alter_Mistaken_Definitions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<long>(
name: "CampaignId",
table: EntityDefinitions.ActivationCode,
nullable: false);
migrationBuilder.AddForeignKey(
name: "FK_ActivationCode_Campaign_CampaignId",
table: EntityDefinitions.ActivationCode,
column: "CampaignId",
principalTable: EntityDefinitions.Campaign,
onDelete: ReferentialAction.Restrict);
migrationBuilder.AlterColumn<int>(
name: "Quantity",
table: EntityDefinitions.HandlingLine,
nullable: true,
oldClrType: typeof(long),
oldType: "bigint",
oldNullable: true);
migrationBuilder.AddColumn<char[]>(
name: "Code",
table: EntityDefinitions.CampaignType,
nullable: false);
migrationBuilder.AddColumn<string>(
name: "Password",
table: EntityDefinitions.Registration,
nullable: true,
defaultValue: string.Empty);
migrationBuilder.AddColumn<bool>(
name: "Percentage",
table: EntityDefinitions.HandlingLine,
nullable: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn("CampaignId", EntityDefinitions.ActivationCode);
migrationBuilder.DropForeignKey("FK_ActivationCode_Campaign_CampaignId", EntityDefinitions.ActivationCode);
migrationBuilder.AlterColumn<long>(
name: "Quantity",
table: EntityDefinitions.HandlingLine,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.DropColumn("Code", EntityDefinitions.CampaignType);
migrationBuilder.DropColumn("Password", EntityDefinitions.Registration);
migrationBuilder.DropColumn("Percentage", EntityDefinitions.HandlingLine);
}
}
Any advice would be nice.
Thanks!
1 Answer(s)
-
0
This seems related with your recent EfCore fluent api configuration. You may be seeding null or non-existing data for
CampaignId
ofEntityDefinitions.ActivationCode
table.