Open isaaclyman opened 1 month ago
You would need to copy-paste this and add it to the Mysql8Generator, and update the test for Mysql8Generator to not include this.
The interface is here: https://github.com/fluentmigrator/fluentmigrator/blob/main/test/FluentMigrator.Tests/Unit/Generators/BaseColumnTests.cs#L41-L42
You need to add a new stub tests for đź‘Ť
public abstract void CanRenameColumnWithCustomSchemaAndDefaultValue();
public abstract void CanRenameColumnWithDefaultSchemaAndDefaultValue();
The test should be updated here: https://github.com/fluentmigrator/fluentmigrator/blob/6fe6395fd3fd9e933e5f49f648aa9bef82ddc55f/test/FluentMigrator.Tests/Unit/Generators/MySql4/MySql4ColumnTests.cs#L215-L233
For all other generators you can have the tests call the other test case, e.g.
public override void CanRenameColumnWithCustomSchemaAndDefaultValue()
{
CanRenameColumnWithCustomSchema();
}
I've been hoping to have time to submit a fix, but I just don't think it's likely. If someone else is available, feel free to pick this one up.
Thank you for getting back!
Describe the bug When attempting to rename a column in MySQL 8, if that column has an expression default value (like
CURRENT_TIMESTAMP
), Fluent Migrator incorrectly includes the cosmetic informationDEFAULT_GENERATED
in the query, which causes a MySql exception.To Reproduce
Migration:
Generated SQL:
Error:
Expected behavior I would expect the rename to ignore the
DEFAULT_GENERATED
and generate a correct query.Information (please complete the following information):
Additional context The Phinx migration library for PHP faced a similar issue: https://github.com/cakephp/phinx/pull/2253