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 answers

0
Amir Hosein Salimi 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
Marcaum54 On

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

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