Skip to content

Charset not added to CHANGE command #2008

@mc0re

Description

@mc0re

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions