AdonisJS migration Error on PostgreSQL : withSchema is not a function

时间:2017-12-18 04:55:57

标签: knex.js adonis.js

I want to create a DB under non-public Schema in PostgreSQL. In knexjs document :

knex.schema.withSchema('public').createTable('users', function (table){
  table.increments();
})

My migration code is:

this.withSchema('myschema').create('users', table => {
  table.increments()
})

But migration:run returns this error:

TypeError: this.withSchema is not a function

How can I create DB under custom schema?

1 个答案:

答案 0 :(得分:0)

来自knex docs的示例实际上可行:

https://runkit.com/embed/zbhlv44ry8xf

您的迁移代码中的this似乎不是knex实例。