title: VS Error: The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull
body: <p>I am using Visual Studio 2015 with Entity Framework 6 and MySQL Server 5.7.13
  The mysql server is from a web and mysql server hosting service online, and I access it using phpmyadmin.</p>
  
  <p>I get the following error when I try to update/generate Model from database (the server connection is successful)</p>
  
  <pre>Unable to generate the model because of the following exception: 'System.Data.StrongTypingException: The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull. ---> System.InvalidCastException: Specified cast is not valid.
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()
     --- End of inner exception stack trace ---
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateProperties(IList`1 columns, IList`1 errors, List`1& keyColumns, List`1& excludedColumns, List`1& invalidKeyTypeColumns)
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntityType(IList`1 columns, Boolean& needsDefiningQuery)
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable`1 tableDetailsRows, EntityRegister entityRegister, IList`1 entitySetsForReadOnlyEntityTypes, DbObjectType objectType)
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable`1 tableDetailsRowsForTables, IEnumerable`1 tableDetailsRowsForViews, EntityRegister entityRegister)
     at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.Build(StoreSchemaDetails storeSchemaDetails)
     at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
     at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
     at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
     at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)'.
  Loading metadata from the database took 00:00:00.6311313.
  Generating the model took 00:00:01.9805600.
  </pre>
  
  <p>This question has been asked, and answered several times, with most people agreeing that either of these solutions will solve the problem:<br/>
  - downgrading to MySQL 5.6<br/>
  - set global optimizer_switch='derived_merge=OFF' (<em>requires SUPER privileges</em>)<br/>
  - set @@optimizer_switch='derived_merge=OFF'<br/></p>
  
  <p>I spoke to support (from my phpmyadmin tool) and asked them to help me with either one of the solutions above, and this was their reply:</p>
  
  <pre>
  The MySQL version on all servers was very recently upgraded to MySQL 5.7.
  
  Indeed, super user privileges are not available for your MySQL users. 
  Also, it is not technically possible to revert the MySQL version back to 5.6. 
  </pre>
  
  <p>I further asked them why these solutions would not be possible, since these are <strong>the only known solutions to my problem</strong>, and this was their final reply:</p>
  
  <pre>
  Please note that your account is hosted on a shared hosting server, 
  and there are lots of other users whose accounts are located on the same server 
  where your account is hosted, hence we cannot globally turn off that feature, 
  as this would affect negatively the performance of the database server for 
  all the hosting accounts on the server (including your account as well).
  </pre>
  
  <p>So my final question to the community: <strong>anyone here knows any solution other than the ones listed above (specific to my case and restrictions)</strong>?</p>