Using existing database in adonis

Hi everyone,

I’ve been looking over Adonis on the recommendation of a friend, and am very impressed with what you get ‘out of the box’ with regard to authentication and database support, among many other things.

That said, the samples I’ve seen so far have dealt with migrations in which our database and tables are created using migration scripts.

I was wondering if there are any tips on how to approach things when you already have an existing (in my case, SQL Server) database with tables established? Just whip up some Lucid models that mirror the db structure, or another way to go about it?

Thanks much, and I’m looking forward to using Adonis more and more, and getting the word out.


I am pretty sure you only have to do the models related to every table on your database


In your model you’re able to use any table by overriding the convention, like so:

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

More reading here.

Hope this helps


Thanks all, it sounds like there’s no special setup I need to do in order to use an existing database, no hidden configuration file deep in Adonis that is maintained via migrations or some such method. Good to know, and thanks for the reading list.

1 Like

yeah since adonis supports in an official way many databases engines, you only need to have running in a proper way your sql server on your machine.

It is not working here

its still trying to connect to the default table name