1575322618141_organizations_schema.js

24 lines | 587 B Blame History Raw Download
'use strict'

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

class OrganizationsSchema extends Schema {
  up () {
    this.create('organizations', (table) => {
      table.increments('id')
      table.string('name').notNullable().unique()
      table.string('email').notNullable()
      table.string('phone').notNullable()
      table.integer('organization_type_id').notNullable().references('id').inTable('organization_types')
      table.timestamps()
    })
  }

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

module.exports = OrganizationsSchema