I´m trying to update a MySql Database field to an automated datetime field using Migrations.
Here is the code:
public partial class AutomatedDateField : DbMigration
{
public override void Up()
{
this.AlterColumn("Orders", "Created", c => c.DateTime(nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"));
}
Using SQL Server i would use GETUTCDATE()
in defaultValueSql. What should i use in this case?
You can't use function as default value for column in MySQL.
Possible solution can be found here: Can I use a function for a default value in MySql?