-
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
Ignore zerofill in MySqlTypeMappingSource #753
Comments
Zerofill is non-standard and is only used for display purposes within apps like MySQL Workbench, but serves no purpose in EF Core other than to specify a field is unsigned. The scaffold code in this library could be modified to strip the zerofill and replace with unsigned (if not already specified). If someone would like to create a PR for that purpose then we'll review it for inclusion. Pomelo.EntityFrameworkCore.MySql/src/EFCore.MySql/Scaffolding/Internal/MySqlDatabaseModelFactory.cs Lines 144 to 145 in c58e00c
There was also a similar issue in the upstream RelationalTypeMapper class that meant stripping precision from unsigned fields to allow mapping. |
The current MySQL docs state the following:
I will therefore close this issue. |
Can I still provide a pull request? For reasons our customers are on 5.5 and up on the beat |
I don't see any issues with adding this feature to the |
Okay, so I finally got 2.2-maint working together with EFCorePowerTools that I am working with. And there's two ways I could correct this. Pomelo.EntityFrameworkCore.MySql/src/EFCore.MySql/Scaffolding/Internal/MySqlDatabaseModelFactory.cs Lines 144 to 145 in c58e00c
or I could add { "tinyint unsigned zerofill", _utinyint },
{ "smallint unsigned zerofill", _usmallint },
{ "mediumint unsigned zerofill", _uint },
{ "int unsigned zerofill", _uint },
{ "bigint unsigned zerofill", _ubigint }, to Pomelo.EntityFrameworkCore.MySql/src/EFCore.MySql/Storage/Internal/MySqlTypeMappingSource.cs Lines 124 to 134 in c58e00c
Which would be preferred? |
If this is just about reverse engineering, then stripping it from the store type, as already done with We did improve this part recently for |
Steps to reproduce
The issue
After finishing work on supporting mysql reverse engineering to generate entity files here: ErikEJ/EFCorePowerTools#17 - I discovered our columns with
int(3) unsigned zerofill
weren't being generated as properties.Appears to be missing from this file: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/blob/master/src/EFCore.MySql/Storage/Internal/MySqlTypeMappingSource.cs#L110
The property would have been generated here: https://github.com/aspnet/EntityFrameworkCore/blob/master/src/EFCore.Design/Scaffolding/Internal/CSharpEntityTypeGenerator.cs#L196
Further technical details
MySQL version: 5.5.45
Operating system: Windows 10
Pomelo.EntityFrameworkCore.MySql version: 2.2.0
Microsoft.AspNetCore.App version: Not used
Other details about my project setup: Used https://github.com/ErikEJ/EFCorePowerTools to reverse engineer a database
The text was updated successfully, but these errors were encountered: