Base solution for your next web application
Open Closed

Does v8.1 have Breaking Changes in EF Core Migrations? #8336


User avatar
0
cyklussoftware created

I am upgrading from ASP.NET Zero v7.1 (.NET Core 2.2 + Angular) to ASP.NET Zero v8.1 (.NET Core 3.1 + Angular) and I noticed that ALL of the migrations (including the Initial Migration) have changed.

I believe the only change to the previous migrations was that each and every column in the Designer.cs files now have .HasColumnType applied to them. Is this considered a major breaking change for upgrading from previous versions of ASP.NET Zero or from EF Core 2.2 to EF Core 3.1?

Also, for general reference, after generating a migration using the RAD tool, I would manually change the Delete Behavior from CASCADE to RESTRICT. But I never updated the Designer files. Is it necessary to update the designer files or somehow re-create them? Or is it OK to simply update the main Up and Down methods?

Thanks


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    see https://github.com/aspnetzero/aspnet-zero-core/pull/2835 https://github.com/aspnetzero/aspnet-zero-core/pull/2864

  • User Avatar
    0
    cyklussoftware created

    @maliming Thanks for pointing me to those issues. When it comes to Entity Framework Core, would those changes be considered breaking changes? By breaking change, I mean a change that shouldn't be applied to a database that is currently in production. Or, if I create a new database for a new tenant, would it create an inconsistency between the existing database and the new database?

  • User Avatar
    0
    maliming created
    Support Team

    This is an enhancement to the migration file, because the migration function of ef core 3.1 has changed, we just follow it to change.

    You should modify your migration file based on the contents of the above two PR, as it may cause errors in future ef core.

    Currently it will only cause problems with https://support.aspnetzero.com/QA/Questions/8142.

  • User Avatar
    0
    cyklussoftware created

    @maliming Thanks for the clarification