'use strict'
const Schema = use('Schema')
const Database = use('Database')
class StatusSchema extends Schema {
up () {
this.create('statuses', (table) => {
table.increments()
table.string('name')
table.timestamps()
})
this.schedule( async (trx) => {
const id = await Database.table('statuses')
.transacting(trx)
.insert([
{name: 'active'},
{name: 'inactive'}
])
})
}
down () {
this.drop('statuses')
}
}
module.exports = StatusSchema
I got this error when I tried to run the migration script above
TypeError: this.schedule is not a function
at StatusSchema.up (/home/user/Documents/adonis/mysite/database/migrations/1515779191946_status_schema.js:14:10)
at Migration._executeSchema (/home/user/Documents/adonis/mysite/node_modules/@adonisjs/lucid/src/Migration/index.js:250:36)
at Migration._execute (/home/user/Documents/adonis/mysite/node_modules/@adonisjs/lucid/src/Migration/index.js:270:18)
at Migration.up (/home/user/Documents/adonis/mysite/node_modules/@adonisjs/lucid/src/Migration/index.js:362:18)
at
Can u share the version of @adonisjs/lucid
I'm using this version
@adonisjs/[email protected]
This is weird, the support is added in 4.1.2 itself. Would you mind dropping the node_modules directory and re-installing it again?
@thetutlage
I don't see anything about schedule in the 4.1.2, the commit came after that tag.
Ohh crap, yes you are right. Lemme go ahead and release it
Released as 4.13
Most helpful comment
Released as
4.13