Lucid: Migration Error this.schedule is not a functions

Created on 13 Jan 2018  路  6Comments  路  Source: adonisjs/lucid

'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

Most helpful comment

Released as 4.13

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

enniel picture enniel  路  7Comments

alexhenriquepv picture alexhenriquepv  路  3Comments

Karnith picture Karnith  路  5Comments

vrwebdesign picture vrwebdesign  路  3Comments

mtnptrsn picture mtnptrsn  路  5Comments