Bug #74726 | EF migrations fail on long foreign keys | ||
---|---|---|---|
Submitted: | 7 Nov 2014 8:51 | Modified: | 13 Nov 2015 16:26 |
Reporter: | Yannic Staudt | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.9.4, 6.9.5, 6.9.6, 6.9.7, 6.9.8 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | entity framework, long foreign key, migrations |
[7 Nov 2014 8:51]
Yannic Staudt
[16 Dec 2014 5:13]
Chiranjeevi Battula
Hello Yannic Staudt, Thank you for the bug report. Verified based on internal discussion with dev's. Thanks, Chiranjeevi.
[10 Feb 2015 10:03]
Chiranjeevi Battula
Bug#75831 marked as duplicate of this one.
[5 Mar 2015 9:15]
Yannic Staudt
And one more connector released with this stupid bug still included. IT IS UNBELIEVABLE! I'm starting to get really disappointed.
[30 Apr 2015 7:46]
Karl Developer
This is a very suprising bug in the connector. In what world does using a GUID for naming seem like a good idea when you need to re-reference the name later? Are there any suggested work around for this? I have an existing DB where I need to change the foreign and have no consistent way of doing this. Can I determine the current name at runtime somehow? Thanks, Karl
[30 Apr 2015 8:07]
Yannic Staudt
We do use a patched version of Connector/NET and did re-build the foreign key declarations half-automatically (with a tricky SQL script our DBA implemented). The patched version uses the fix I proposed in my bug report initially. It's not a perfect solution but we didn't have any issue with it 'till now.
[24 Sep 2015 12:18]
Yannic Staudt
Issue is still there in 6.9.7; I fixed it this way: http://k16c.eu/2015/09/21/how-to-make-code-first-migrations-truly-usable/ Here's a derived MySQL Migrations Generator as a Nuget package: https://www.nuget.org/packages/Pysco68.MySQL.FixedMigrationsGenerator/
[13 Nov 2015 16:26]
Yannic Staudt
Error still present in Connector/NET 6.9.8
[22 Nov 2018 13:12]
Koen D'Hondt
4 years later this issue is still present. An apparent fix to this issue is to register a new RelationalMaxIdentifierLengthConvention(64) somewhere in MySqlConventionSetBuilder.cs. See also https://github.com/aspnet/EntityFrameworkCore/commit/e8fcce13870909944e88a0cfba88b37453fc8..., which fixed the EF Core issue 10213, EF Generates too long index name, https://github.com/aspnet/EntityFrameworkCore/issues/10213.
[23 Nov 2018 9:14]
Patrick Pasteels
Thanks Mr. Koen D'Hondt for bringing this long outstanding bug back to attention, and for your analysis of the bug. This bug makes the EFCore package somehow unusable if you want to apply EF migrations, so it is indeed very unfortunate that this still isn't fixed, more than 4 years after the original bug report. And even more unfortunate, since it doesn't even seem that difficult to fix, as Mr. D'Hondt's analysis points out.