Tuve el mismo problema, después de leer las publicaciones, decidí crear una clase heredada de MySqlMigrationSqlGenerator y anular protected override MigrationStatement Generate ( CreateIndexOperation op ) , luego, en la configuración de la migración, agrego:SetSqlGenerator ("MySql.Data.MySqlClient", new myMigrationSQLGenerator ( ));
este es el codigo de la clase:
public class myMigrationSQLGenerator : MySqlMigrationSqlGenerator
{
private string TrimSchemaPrefix ( string table )
{
if ( table.StartsWith ( "dbo." ) )
return table.Replace ( "dbo.", "" );
return table;
}
protected override MigrationStatement Generate ( CreateIndexOperation op )
{
var u = new MigrationStatement ( );
string unique = ( op.IsUnique ? "UNIQUE" : "" ), columns = "";
foreach ( var col in op.Columns )
{
columns += ( $"`{col}` DESC{( op.Columns.IndexOf ( col ) < op.Columns.Count - 1 ? ", " : "" )}" );
}
u.Sql = $"CREATE {unique} INDEX `{op.Name}` ON `{TrimSchemaPrefix ( op.Table )}` ({columns}) USING BTREE";
return u;
}
}
y este es el código en Migrations\Configuration.cs :
public Configuration ()
{
AutomaticMigrationsEnabled = false;
SetSqlGenerator ( "MySql.Data.MySqlClient", new myMigrationSQLGenerator ( ) );
}
este trabajo para mí.