EF - Index & Foreign Keys Name Length

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Tarek89
Posts: 2
Joined: Fri 23 Aug 2019 09:15

EF - Index & Foreign Keys Name Length

Post by Tarek89 » Fri 23 Aug 2019 10:06

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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EF - Index & Foreign Keys Name Length

Post by Shalex » Sat 24 Aug 2019 12:33

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)

Post Reply