Postgresql has a limit of 63 characters - relationships

Postgresql has a limit of 63 characters - relationships

Postby ripley » Thu 29 May 2014 14:11

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?
ripley
 
Posts: 1
Joined: Thu 29 May 2014 14:05

Re: Postgresql has a limit of 63 characters - relationships

Postby MariiaI » Fri 30 May 2014 08:02

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 http://www.devart.com/dotconnect/postgresql/docs/?CodeFirstOptions.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
<configSections>
     <section name="Devart.Data.PostgreSql.Entity" type="Devart.Data.PostgreSql.Entity.Configuration.PgSqlEntityProviderConfigurationSection,
Devart.Data.PostgreSql.Entity, Version=7.3.161.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  </configSections>
  <Devart.Data.PostgreSql.Entity xmlns="http://devart.com/schemas/Devart.Data.PostgreSql.Entity/1.0">
    <CodeFirstOptions TruncateLongDefaultNames="true" />
  </Devart.Data.PostgreSql.Entity>
</configuration>

Please tell us if this helps.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for PostgreSQL