This project is read-only.

Migrations: Adding "WithDefault" to a big string column doesn't work in MySQL


I'm using Orchard 1.6 on MySQL, but I can't install some modules (like CKEditor). After doing some debugging and looking through the logs, I found that I get the error that I pasted on the bottom of this issue.

When I look in the migrations.cs file of the CKEditor module, I see that it does this:
SchemaBuilder.AlterTable("CKEditorSettingsPartRecord", table => table.AddColumn<string>("ExtraPlugins", c => c.WithDefault(CKEditorSettingsPartRecord.DefaultExtraPlugins).WithLength(1024)));

So adding a default value to a column of type string with a length of 1024 or more doesn't work when you use MySQL. I'm not sure if this can even be fixed if MySQL just doesn't allow default values on text columns, unless you can make it so that the migrations don't make a text file. Since MySQL 5.0.3, it's possible to have varchar columns with a maximum length of 65,535.

Exception has been thrown by the target of an invocation. ---> MySql.Data.MySqlClient.MySqlException: BLOB/TEXT column 'ExtraPlugins' can't have a default value
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.RunPendingStatements() in D:\Orchard 1.6\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 347
at Orchard.Data.Migration.Interpreters.DefaultDataMigrationInterpreter.Visit(AlterTableCommand command) in D:\Orchard 1.6\src\Orchard\Data\Migration\Interpreters\DefaultDataMigrationInterpreter.cs:line 135
at Orchard.Data.Migration.Interpreters.AbstractDataMigrationInterpreter.Visit(ISchemaBuilderCommand command) in D:\Orchard 1.6\src\Orchard\Data\Migration\Interpreters\AbstractDataMigrationInterpreter.cs:line 17
at Orchard.Data.Migration.Schema.SchemaBuilder.AlterTable(String name, Action`1 table) in D:\Orchard 1.6\src\Orchard\Data\Migration\Schema\SchemaBuilder.cs:line 26
at CKEditor.Migrations.UpdateFrom1()