Changing database connection in Model


I am using two database connections
database: database01
database: database02
mysql1 is the default connection and mysql2 is used in specific models using the static method get connection(). But while executing the migration all my models are creating its tables in the same database. I need to create the tables to its specific databases. Thanks in advance!


According to docs, you need to do the following

const Schema = use('Schema')

class UsersSchema extends Schema {

static get connection() {
    return 'mysql'


//after you create the `up()` and `down` regular methods

up () {


down () {




Thank you.