UNPKG

734 BPlain TextView Raw
1import BaseSchema from '@ioc:Adonis/Lucid/Schema'
2
3export default class {{ usersSchemaName }} extends BaseSchema {
4 protected tableName = '{{ usersTableName }}'
5
6 public async up () {
7 this.schema.createTable(this.tableName, (table) => {
8 table.increments('id').primary()
9 table.string('email', 255).notNullable()
10 table.string('password', 180).notNullable()
11 table.string('remember_me_token').nullable()
12
13 /**
14 * Uses timestampz for PostgreSQL and DATETIME2 for MSSQL
15 */
16 table.timestamp('created_at', { useTz: true }).notNullable()
17 table.timestamp('updated_at', { useTz: true }).notNullable()
18 })
19 }
20
21 public async down () {
22 this.schema.dropTable(this.tableName)
23 }
24}