Base solution for your next web application
Open Closed

Running initial migrations against MySQL #12048


User avatar
0
Abaco created

We just licensed ASP.NET Zero for a new project and configured it to use a MySQL db as documented but when trying to run the existing migrations that ship with the project either using the Migrator project, package manager console or the dotnet cli (with the ef addon) we get errors that the syntax and data types being used on the existing migrations is not compatible with MySQL since they seem to have been coded for SQL Server. Examples: datetime2, nvarchar(max), varbinary(max) to name a few.

Is there an easier way other than modifying all of those migrations to be MySQL compatible to get the initial set of entities, indexes, etc created for a project?


3 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @Abaco,

    I suggest you delete all migrations and create an initial migration for MySQL.

  • User Avatar
    0
    Abaco created

    Ok, just did and the migration that gets created isn't a valid one. It starts with dropping FK constraints that dont even exist since the db is empty:

  • User Avatar
    0
    Abaco created

    Ok, I missed one important piece of information from the instructions:

    Remove all migration classes (including DbContextModelSnapshot) under *.EntityFrameworkCore/Migrations folder;