Bug #76191 Index names are generated without quotes in EF 6 Code First Migrations
Submitted: 6 Mar 2015 15:08 Modified: 8 Apr 2015 5:10
Reporter: Alessio Parma Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.6 OS:Windows
Assigned to: CPU Architecture:Any
Tags: code first migrations index code generator

[6 Mar 2015 15:08] Alessio Parma
Description:
Software versions (downloaded from NuGet):
  * EntityFramework 6.1.2
  * MySql.Data.Entity 6.9.6

Migrations which contain indexes cause compilation errors, because MySQL code generator (MySql.Data.Entity.MySqlMigrationCodeGenerator) creates index names without quotes. Example:

.Index(t => new { t.COL_A, t.COL_B }, unique: true, name: UN_test_test)

How to repeat:
Create an entity with an IndexAttribute and run "Add-Migration". Index name will apper without quotes and the generated migration file.

Suggested fix:
Inside:

MySqlMigrationCodeGenerator.GenerateInline(CreateIndexOperation createIndexOperation, IndentedTextWriter writer)

Change string ", name: {0}" with ", name: \"{0}\"", so that index name is quoted. We solved this problem by locally overriding that method, and the proposed fix solved the issue.
[8 Apr 2015 5:10] Chiranjeevi Battula
Hello Alessio Parma,

Thank you for the bug report.
This is duplicate of Bug #73278.

Thanks,
Chiranjeevi.