Files
duty-schedule-api/database/migrations/1634413335137_employees.ts
2021-10-16 23:19:50 +02:00

33 lines
854 B
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Employees extends BaseSchema {
protected tableName = 'employees'
public async up () {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
table.timestamp('updated_at', { useTz: true })
table.string('first_name ')
table.string('last_name')
table.string('shorthand').unique()
table.string('email')
table.string('phone')
table.string('mobile')
table.decimal('contract_hours', 2, 2)
table
.integer('user_id')
.unsigned()
.references('users.id')
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}