Added settings API
This commit is contained in:
29
database/migrations/1636667124834_settings.ts
Normal file
29
database/migrations/1636667124834_settings.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user