Files
duty-schedule-api/database/migrations/1636667124834_settings.ts
2021-11-12 01:15:40 +01:00

30 lines
700 B
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Settings extends BaseSchema {
protected tableName = 'settings'
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.integer('employee_id')
.unsigned()
.references('employees.id')
.onDelete('CASCADE')
table.string('key')
table.string('value')
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}