-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with scaffolding a column with DATETIME NULL ON UPDATE CURRENT_TIMESTAMP #958
Comments
If I change `modify_date4` DATETIME NULL ON UPDATE CURRENT_TIMESTAMP, to `modify_date4` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, then it generates: entity.Property(e => e.ModifyDate4)
.HasColumnName("modify_date4")
.HasColumnType("datetime")
.HasDefaultValueSql("'CURRENT_TIMESTAMP'")
.ValueGeneratedOnAddOrUpdate(); |
We fixed this in Same goes for this line: .HasDefaultValueSql("'CURRENT_TIMESTAMP'") It should not contain single quotes: .HasDefaultValueSql("CURRENT_TIMESTAMP") The empty call is actually an EF Core issue that already got fixed for |
I moved to EntityFrameworkCore version 3.1.0-preview3.19554.8 and also changed my column data type from `modify_date` TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP I get: entity.Property(e => e.ModifyDate)
.HasColumnName("modify_date")
.HasColumnType("timestamp")
.ValueGeneratedOnUpdate(); The other columns with a default I plan to move to the full release version of EntityFrameworkCore before my product ships next year and hopefully the Pomelo 3.1.0 will be available then too. |
Is the current |
I haven't run into any issues with them together yet. |
The code
MySQL database schema:
Scaffold generated code:
The issue
The modify_date4 ON UPDATE column is generating invalid code.
The entity.Property ends with .(); which must be removed in order to compile.
Further technical details
MySQL version: 8.0.17
Operating system: Windows 10
Pomelo.EntityFrameworkCore.MySql version: 3.0.0
.NET Core 3.0.100
The text was updated successfully, but these errors were encountered: