mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-03 23:36:21 +02:00
22 lines
553 B
Plaintext
22 lines
553 B
Plaintext
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
|
|
|
export default class extends BaseSchema {
|
|
protected tableName = '{{#toTableName}}{{ filename }}{{/toTableName}}'
|
|
|
|
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 })
|
|
})
|
|
}
|
|
|
|
public async down () {
|
|
this.schema.dropTable(this.tableName)
|
|
}
|
|
}
|