Page 1 of 1

Postgresql has a limit of 63 characters - relationships

Posted: Thu 29 May 2014 14:11
by ripley
I am using dotConnect for Postgresql and I am having a problem with the way entity framework code first generates table relationship names. The convention seems to be < ChildTableName>_<ParentTableName>_<Column>. Since my table and column names are long this results in long relationship names. Postgresql has a limit of 63 characters for identifiers so this causes a problem for me. Is there a way to modify this convention? If not, what other options (apart from using shorter table and column names) do I have?

Re: Postgresql has a limit of 63 characters - relationships

Posted: Fri 30 May 2014 08:02
by MariiaI
There is a config.CodeFirstOptions.TruncateLongDefaultNames configuration option, which is used to provide the possibility of truncating long default names of indexes, primary keys, foreign keys, triggers, and sequences generated by Code-First Migrations.
Please refer to ... tions.html.

For example, you can do it in the code:

Code: Select all

var config = Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfig.Instance;
config.CodeFirstOptions.TruncateLongDefaultNames = true;
Also, you can do it in the config file. For example:

Code: Select all

     <section name="Devart.Data.PostgreSql.Entity" type="Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfigurationSection, 
Devart.Data.PostgreSql.Entity, Version=, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  <Devart.Data.PostgreSql.Entity xmlns="">
    <CodeFirstOptions TruncateLongDefaultNames="true" />
Please tell us if this helps.