Bug #74239 FixedLength appear in TimeSpan type EF migration
Submitted: 6 Oct 2014 21:14 Modified: 18 May 2015 17:52
Reporter: Gabriela Martinez Sanchez Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.8, 6.9 OS:Any
Assigned to: CPU Architecture:Any

[6 Oct 2014 21:14] Gabriela Martinez Sanchez
Description:
I have the following EF 6.1.1 model:

 public class Person
    {
        [Key]
        public int PersonId { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public TimeSpan TimeTest { get; set;}
    }

    public class PersonalContext : DbContext
    {
        public DbSet<Person> Persons { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }
    }

I run the project the first time, which creates an initial table in the database. 

Then I run this to generate the initial migrations:

This is the resulting code of the migration:

 public override void Up()
        {
            CreateTable(
                "People",
                c => new
                    {
                        PersonId = c.Int(nullable: false, identity: true),
                        Name = c.String(unicode: false),
                        Address = c.String(unicode: false),
                        TimeTest = c.Time(nullable: false, precision: 0, fixedLength: true),
                    })
                .PrimaryKey(t => t.PersonId)                ;
            
        }

The migration code is wrong due that the fixedlength attribute does not exist in the Time method.

How to repeat:
Create an application with EF 6.1. 
run enable-migrations
run add-migration initial

Suggested fix:
N.A.
[18 May 2015 17:48] Chiranjeevi Battula
Hello Gabriela Martinez Sanchez,

Thank you for the bug report.
I could not repeat the issue on Visual Studio 2013 (C#.Net) with MySQL Connector/Net 6.9.6, EF6.1.1 and EF6.1.3.

Thanks,
Chiranjeevi.
[18 May 2015 17:49] Chiranjeevi Battula
screenshot

Attachment: 74239.PNG (image/png, text), 63.25 KiB.

[11 Feb 2018 3:59] g s
Same problem
EntityFramework 6.2.0
MySql.Data , MySql.Data.Entity.EF6 6.10.6

Source.cs :
   [Column( TypeName = "time" )]
   public TimeSpan RunAt { get; set; }

Migration :
   RunAt = c.Time(nullable: false, precision: 0, fixedLength: true)