8.12.1357 script error EF migration

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
KW
Posts: 135
Joined: Tue 19 Feb 2008 19:12

8.12.1357 script error EF migration

Post by KW » Thu 11 Apr 2019 01:47

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: 8.12.1357 script error EF migration

Post by Shalex » Thu 11 Apr 2019 19:20

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?

KW
Posts: 135
Joined: Tue 19 Feb 2008 19:12

Re: 8.12.1357 script error EF migration

Post by KW » Thu 11 Apr 2019 19:33

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: 8.12.1357 script error EF migration

Post by Shalex » Mon 22 Apr 2019 12:41

We have reproduced the bug and will notify you when it is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: 8.12.1357 script error EF migration

Post by Shalex » Fri 07 Jun 2019 18:18

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.

Post Reply