1584139902145_modify_submission_dates_nullable_schema.js

27 lines | 718 B Blame History Raw Download
'use strict'

/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')

class ModifySubmissionDatesNullableSchema extends Schema {
  up () {
    this.alter('submissions', (table) => {
      // alter table
      table.date('upload_date').nullable().alter()
      table.date('creation_date').nullable().alter()
      table.date('published_date').nullable().alter()
    })
  }

  down () {
    this.alter('submissions', (table) => {
      // reverse alternations
      table.date('upload_date').notNullable().alter()
      table.date('creation_date').notNullable().alter()
      table.date('published_date').notNullable().alter()
    })
  }
}

module.exports = ModifySubmissionDatesNullableSchema