Page 1 of 1

EF - Index & Foreign Keys Name Length

Posted: Fri 23 Aug 2019 10:06
by Tarek89
Hi,
PostgreSQL have a limitation for Index and ForienKey names of 63, however, the default behavior is to just truncate the name. DotConnect PostgreSQL provider fails to update the database because of these errors. Is there anyway to ignore these errors or modify the ForeignKeys before creation?

Re: EF - Index & Foreign Keys Name Length

Posted: Sat 24 Aug 2019 12:33
by Shalex
Tarek89 wrote: Fri 23 Aug 2019 10:06PostgreSQL have a limitation for Index and ForienKey names of 63, however, the default behavior is to just truncate the name.
Refer to https://www.devart.com/dotconnect/postg ... tions.html > the TruncateLongDefaultNames option.
Tarek89 wrote: Fri 23 Aug 2019 10:06DotConnect PostgreSQL provider fails to update the database because of these errors. Is there anyway to ignore these errors or modify the ForeignKeys before creation?
If config.CodeFirstOptions.TruncateLongDefaultNames=true; doesn't help, an alternative solution could be setting Index and ForienKey names explicitly via:
a) fluent mapping (EF 6.2 and EF Core)
b) code-based code-first migrations (EF 6.1 and earlier)