Pomelo.EntityFrameworkCore.MySql icon indicating copy to clipboard operation
Pomelo.EntityFrameworkCore.MySql copied to clipboard

Charset not added to CHANGE command

Open mc0re opened this issue 6 months ago • 0 comments

Describe the bug An EFCore migration operation:

migrationBuilder.RenameColumn(
    name: "OutputPath",
    table: "Files",
    newName: "PR_OutputPath")
    .Annotation("MySql:CharSet", "utf8mb4");

is converted to this SQL command:

ALTER TABLE `Files` CHANGE `OutputPath` `PR_OutputPath` longtext NULL;

The charset annotation is lost. Unfortunately, the command fails without it (verified manually) due to non-ASCII characters in some of the pre-existing rows, and despite the fact that the column already has utf8mb4 charset.

Expected behavior The expected command is:

ALTER TABLE `Files` CHANGE `OutputPath` `PR_OutputPath` longtext CHARACTER SET utf8mb4;

Technical details (please complete the following information):

  • Database server version: mariadb Ver 15.1 Distrib 10.4.32-MariaDB
  • Operating system: CentOS
  • Pomelo.EntityFrameworkCore.MySql version: 9.0.0

mc0re avatar Aug 18 '25 22:08 mc0re