Page 1 of 1

8.12.1357 script error EF migration

Posted: Thu 11 Apr 2019 01:47
by KW
dotnet ef migrations script --context ConfigurationDBContext
-- Script was generated by Devart dotConnect for MySQL, Version 8.12.1357
-- Product home page: http://www.devart.com/dotconnect/mysql
-- Database version: MySQL 8.0.14
-- Script date 4/10/2019 6:14:51 PM

ALTER TABLE ApiResources
ADD COLUMN Created datetime DEFAULT CAST('0001-01-01 00:00:00' AS DATETIME) NOT NULL;

The cast() is unnecessary. The value is automatically converted to the correct type:

ALTER TABLE Table1 ADD COLUMN Created datetime DEFAULT '0001-01-01 00:00:00' NOT NULL;
MySQL allows constants for default values but does not permit expressions.

Re: 8.12.1357 script error EF migration

Posted: Thu 11 Apr 2019 19:20
by Shalex
Please open Property Editor and Press ... against the Column field to open Column Editor. There is the Length field in this dialog. Is that what you need?

Re: 8.12.1357 script error EF migration

Posted: Thu 11 Apr 2019 19:33
by KW
This script is generated using ef migration commands in package manager console.

For some reason it generates a cast function for default value, which is illegal. Only constants are accepted.

Re: 8.12.1357 script error EF migration

Posted: Mon 22 Apr 2019 12:41
by Shalex
We have reproduced the bug and will notify you when it is fixed.

Re: 8.12.1357 script error EF migration

Posted: Fri 07 Jun 2019 18:18
by Shalex
The bug with setting default values for the DateTime and TimeSpan columns in the ALTER statements in EF Core 2 Code-First Migrations is fixed: viewtopic.php?f=2&t=38883.