Bug #80886 Custom Indexes are not created in the database with Entity Framework Code First
Submitted: 29 Mar 2016 14:02 Modified: 31 Mar 2016 5:48
Reporter: Julian GR Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.9.8.0 OS:Windows
Assigned to: CPU Architecture:Any
Tags: entity framework, indexes

[29 Mar 2016 14:02] Julian GR
Description:
The problem is using Entity Framework Code First with the mysql net connector. 
If i create a class and specify that one column must have an Index, when the database creation happens the index is not created in the database. 
Im using Entity Framework 6.1 and Connector Net 6.9.8.0

How to repeat:
1) Configure Entity framework for working with mysql 
2) Create the following class:
    
public class Test
    {
        public int TestId { get; set; }
        [Index( "ix_column1", IsClustered=true, IsUnique=false)]
        public int Column1 { get; set; }
        public int Column2 { get; set;  
    }

3) Create the context with the Dbset<Test> in it
4) Create the a form that uses the context to force database creation
5) Check if the index is created in the database 

Suggested fix:
[30 Mar 2016 7:07] Chiranjeevi Battula
Hello Julian Gimenez Roland,

Thank you for the bug report.
I tried to reproduce the issue at my end using Visual Studio 2013 (C#.Net) and Connector/Net 6.9.8 but not seeing any issues to create custom Indexes.
Could you please list out exact steps you tried out at your end, this would help us to reproduce the issue at our end.

Thanks,
Chiranjeevi.
[30 Mar 2016 7:09] Chiranjeevi Battula
table script:

mysql> show create table test_80886\G;
*************************** 1. row ***************************
       Table: test_80886
Create Table: CREATE TABLE `test_80886` (
  `TestId` int(11) NOT NULL AUTO_INCREMENT,
  `Column1` int(11) NOT NULL,
  `Column2` int(11) NOT NULL,
  PRIMARY KEY (`TestId`),
  KEY `ix_column1` (`Column1`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
[31 Mar 2016 5:48] Chiranjeevi Battula
Hello Julian Gimenez Roland,

Thank you for your feedback.

Thanks,
Chiranjeevi.