Bug #85902 Migration
Submitted: 11 Apr 2017 14:47 Modified: 5 Jun 2020 21:23
Reporter: NAU Nathan Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version: 6.10.1 beta and 7.0.7 m6 OS:Any
Assigned to: CPU Architecture:Any

[11 Apr 2017 14:47] NAU Nathan
Description:
The check for table '__EFHistory' existing fail.

How to repeat:
Use DbContext.Database.Migrate()

Suggested fix:
in file Source\MySql.Data.EntityFrameworkCore\Migrations\Internal\MySQLHistoryRepository.cs :

61,62c61,62
< builder.AppendLine("SELECT 1 FROM information_schema.tables ")
< .AppendLine("WHERE table_name = '")
---
> builder.Append("SELECT 1 FROM information_schema.tables ")
> .Append("WHERE table_name = '")
71c71
< protected override bool InterpretExistsResult(object value) => value != DBNull.Value;
---
> protected override bool InterpretExistsResult(object value) => value != null;
[13 Apr 2017 8:13] Chiranjeevi Battula
Hello NAU Nathan,

Thank you for the bug report.
Could you please provide repeatable test case (steps/sample project, code, screenshot, database/create table statements etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[13 Apr 2017 11:29] NAU Nathan
Demo

Attachment: OracleBug1.rar (application/octet-stream, text), 3.14 KiB.

[17 Apr 2017 5:39] Chiranjeevi Battula
Hello NAU Nathan,

Thank you for the bug report and test case.
Verified this behavior on Visual Studio 2017 (C#.Net) and Connector/NET 6.10.1 version.

Thanks,
Chiranjeevi.
[17 Apr 2017 5:39] Chiranjeevi Battula
Screenshot

Attachment: 85902.JPG (image/jpeg, text), 230.74 KiB.

[28 May 2020 14:22] Daniel Valdez
Posted by developer:
 
Method which validates if a table exists, changed to evaluate a null instead of DbNull.
[5 Jun 2020 21:23] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 8.0.22 release, and here's the proposed changelog entry from the documentation team:

The DbContext.Database.Migrate() method did not succeed because the
__efmigrationshistory table was not found. This fix modifies the method
that validates the existence of the table.

Thank you for the bug report.