APCOvernight/adonis-schema-builder

View on GitHub
src/Generators/templates/schema.mustache

Summary

Maintainability
Test Coverage
'use strict'

const Schema = use('Schema')

class {{ name }} extends Schema {
  up () {
    this.create('{{ table }}', (table) => {
    {{ #columnsArray }}
      {{ &knexString }}
    {{ /columnsArray }}
    {{ #timestamp }}
      table.timestamps()
    {{ /timestamp }}
    {{ #softDelete }}
      table.softDeletes()
    {{ /softDelete }}
    })
  }

  down () {
    this.drop('{{ table }}')
  }
}

module.exports = {{ name }}