Search code examples
asp.netasp.net-corepomelo-entityframeworkcore-mysql

Referenced table is not in dictionary


When I scaffold my database get the following error:

Referenced table `contentcategory` is not in dictionary.
Referenced table `contentcategory` is not in dictionary.
Referenced table `contenttype` is not in dictionary.
Referenced table `content` is not in dictionary.

I Use Mysql and Pomelo.EntityFrameworkCore.MySql


Solution

  • This is very likely to be a casing issue, where MySQL assumes the table name to be contentcategory for the reference, while it is actually something like ContentCategory.

    We have a pull request for this open since April, that looks abandoned by the original contributor.

    I will fix the PR and merge it, so that the workaround for this issue will be part of our nightly builds as of tomorrow.

    The linked PR also contains the information of how this issue can arise:

    Okay, that is in line with what I experienced as well. So manually (either by writing the name in the GUI or by using an ALTER TABLE statement directly) adding a reference with different casing (on a server with case insensitive file name handling) or disabling SQL Identifiers are Case Sensitive [in MySQL Workbench] can lead to this result.

    Technically, this is a MySQL or Workbench bug, but we will implement a workaround for it anyway.