I have .Net Core Web API with MariaDB server. After update Pomelo and EF Core from 2 version to 3 exception is thrown while trying to apply migration with rename column logic.
Migration :
public partial class EmployeeTimeCardChanges : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "EmpolyeeName",
table: "EmployeeTimeCards",
newName: "JobTitleName");
...
EF Core logs:
info: Microsoft.EntityFrameworkCore.Migrations[20402]
Applying migration '20190516061945_EmployeeTimeCardChanges'.
info: Microsoft.EntityFrameworkCore.Database.Command[20100]
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE `EmployeeTimeCards` RENAME COLUMN `EmpolyeeName` TO `JobTitleName`;
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (111ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
ALTER TABLE `EmployeeTimeCards` RENAME COLUMN `EmpolyeeName` TO `JobTitleName`;
As far as I know MariaDb is not supporting such syntax yet.
MariaDB version: 10.4.6
Operating system: Windows 10 Pro x64
Pomelo.EntityFrameworkCore.MySql version: 3.0.0
Microsoft.AspNetCore.App version: 3.0.0
Are you specifying ServerVersion in configuration options when you set up your context?
c#
options.UseMySql(myConnectionString, builder =>
builder.ServerVersion(new ServerVersion(new Version(10, 4, 6), ServerType.MariaDb)));
If no ServerVersion is configured, it is assumed you are using the latest Version of MySQL.
Thanks, it works now. I've added ServerVersion in configuration.
Most helpful comment
Are you specifying ServerVersion in configuration options when you set up your context?
c# options.UseMySql(myConnectionString, builder => builder.ServerVersion(new ServerVersion(new Version(10, 4, 6), ServerType.MariaDb)));If no
ServerVersionis configured, it is assumed you are using the latest Version of MySQL.