1 | import BaseSchema from '@ioc:Adonis/Lucid/Schema'
|
2 |
|
3 | export default class {{#toClassName}}{{ filename }}{{/toClassName}} extends BaseSchema {
|
4 | protected tableName = '{{#toTableName}}{{ filename }}{{/toTableName}}'
|
5 |
|
6 | public async up () {
|
7 | this.schema.createTable(this.tableName, (table) => {
|
8 | table.increments('id')
|
9 |
|
10 | /**
|
11 | * Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
|
12 | */
|
13 | table.timestamp('created_at', { useTz: true })
|
14 | table.timestamp('updated_at', { useTz: true })
|
15 | })
|
16 | }
|
17 |
|
18 | public async down () {
|
19 | this.schema.dropTable(this.tableName)
|
20 | }
|
21 | }
|