Vincit / objection.js

An SQL-friendly ORM for Node.js
https://vincit.github.io/objection.js
MIT License
7.28k stars 639 forks source link

Possibility to edit ID_LENGTH_LIMIT #2242

Open chilander1 opened 2 years ago

chilander1 commented 2 years ago

It would be good to have a possibility to edit ID_LENGTH_LIMIT (/objection/lib/queryBuilder/join/utils.js) Sometimes when I use withGraphJoined I get very long aliases and an error like

ValidationError: identifier training:program:company:some_veeeeeeery_loooooooong_column_name is over 63 characters long and would be truncated by the database engine.

abedmurrar commented 2 years ago

you can use

withGraphJoined(
  {
    training: {
      program: {
        company: true,
      },
    },
  },
  { minimize: true } // minimizes tables names 
);

https://vincit.github.io/objection.js/api/types/#type-graphoptions