-
Notifications
You must be signed in to change notification settings - Fork 386
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
Database scaffolding produces empty method call and no ValueGeneratedOn*() call when using datetime/timestamp columns #877
Comments
Issue 2 & 3 are likely to be related.
The point of this method is, that you can implement it in a partial class. If you implement it, it will be called as part of |
Thanks, I had wondered if it was there as a placeholder in case it was needed. |
Issue 1 is not an issue, but the correct behavior. Issue #703 is just a special case, where single quotes are invalid. For issue 2/3, I opened dotnet/efcore#18579 upstream, as this seems to be a bug in EF Core. In your specific case, we can actually solve this by safely applying |
Introduce a workaround for the missing EF Core handling of `ValueGenerated.OnUpdate`. Fixes PomeloFoundation#877
* Add support to reverse engineer views. Add comments for tables and columns. Improve handling of default values. * Handle the `CURRENT_TIMESTAMP` default value for `timestamp` columns correctly. Fixes #703 * Correctly implement `CURRENT_TIMESTAMP` with `ON UPDATE` clauses. Introduce a workaround for the missing EF Core handling of `ValueGenerated.OnUpdate`. Fixes #877 * Remove unnecessary code Can probably remove this code as it only applies to Release Candidate not General Availability versions. https://bugs.mysql.com/bug.php?id=89793 >The NON_UNIQUE column in the INFORMATION_SCHEMA.STATISTICS table had type BIGINT prior to MySQL 8.0, but became VARCHAR in MySQL 8.0 with the introduction of the data dictionary. The NON_UNIQUE column now has an integer type again (INT because the column need not be as large as BIGINT). * Correctly map `unsigned` database types with precision, scale, size or display width to CLR types. * Fix table/view determination. * Support views in `MySqlDatabaseCleaner`. * Fix some Timestamp/RowVersion issues. Still depends on dotnet/efcore#18592 Addresses #792
The upstream bug is fixed and will be in the 3.1 release. |
Steps to reproduce
Create the table:
Run the scaffolder:
The issue
The scaffolder produces the following:
Issue 1: The default value strings have added single quotes which may be a problem but that behavior is already detailed in Issue #703.
Issue 2: The datetime and timestamp properties have an empty method call
.()
appended which causes build errors.Issue 3: I would expect the scaffolder to append .ValueGeneratedOnUpdate() or .ValueGeneratedOnAddOrUpdate() to the property definition based on the syntax here: https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html. Perhaps there is a bug with this functionality that is causing issue 2?
Also - I'm not sure if the OnModelCreatingPartial() method is supposed to exist here or not as it doesn't appear to be used.
Further technical details
MySQL version: 10.1.41-MariaDB-0ubuntu0.18.04.1
Operating system: Ubuntu 18.04
Pomelo.EntityFrameworkCore.MySql version: 3.0.0-rc1.final
Microsoft.AspNetCore.App version: 3.0
The text was updated successfully, but these errors were encountered: