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

Table name with mixed case #2689

Open zainab-amir opened 4 months ago

zainab-amir commented 4 months ago

Hey,

I have a following table in objection which maps to a table in db that starts with capital 'M'.

class Markers extends Model {
  static get tableName() {
    return 'Marker';
  }
}

Unfortunately when I run the query, objection converts the table name to lower case and I get this error

"select \"marker\".* from \"marker\" where \"id\" in ($1, $2) - relation \"marker\" does not exist",

Is there a way to make objection keep the table name as is and not convert it to lower case?

kapouer commented 3 months ago

Are you using sqlite, mysql, or postgres backend ?

zainab-amir commented 3 months ago

postgres backend

lehni commented 2 months ago

Are you using any name mappers? https://vincit.github.io/objection.js/recipes/snake-case-to-camel-case-conversion.html