How to set table name in Lucid Model?

2.2k Views Asked by At

The framework works by convention (e.g. User → users), works well in english, but in anothers languages can be inelegant...

2

There are 2 best solutions below

0
On

If you're using Adonis.js v5 here's the soultion:

export default class User extends BaseModel {
  public static table = 'different_table_users'
}
0
On

https://adonisjs.com/docs/4.1/lucid#_table

class User extends Model {
  static get table () {
    return 'my_users'
  }
}