1575322806187_contacts_schema.js
Home
/
database /
migrations /
1575322806187_contacts_schema.js
'use strict'
/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
class ContactsSchema extends Schema {
up () {
this.create('contacts', (table) => {
table.increments('id')
table.string('email').notNullable().unique()
table.string('first_name').notNullable()
table.string('last_name').notNullable()
table.string('phone').notNullable()
table.integer('organization_id').notNullable().references('id').inTable('organizations')
table.timestamps()
})
}
down () {
this.drop('contacts')
}
}
module.exports = ContactsSchema