'ASP.NET DATETIME(6) to DATETIME in MySQL

If I understand correctly, MySQL transforms into datetime(6) which I do not want to have.

I have a datetime(6) that I would like to change to datetime but I can't change it.

If someone has the right syntax, or another method?

You have the declaration here of in my model

[DataType(DataType.DateTime)]
public DateTime? CreationDate { get; set; }

The result of mysql

+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| creation_date | datetime(6)  | YES  |     | NULL    |                |

Edit [Resolved]

protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);

            builder.Entity<User>(b =>
            {
                b.Property(x => x.CreationDate).HasColumnType("datetime");
                b.Property(x => x.UpdatedDate).HasColumnType("datetime");
            });
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source