created User-Model and Employee-Model

This commit is contained in:
Sockenklaus
2021-10-16 23:19:50 +02:00
parent 4acf451351
commit 93e2b9c445
20 changed files with 2958 additions and 88 deletions

View File

@@ -0,0 +1,32 @@
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)
}
}