aboutsummaryrefslogtreecommitdiffstats
path: root/database/migrations/1503250034279_user.ts
blob: 4a58213e1c91c250df78f4ac1f31fff0d488a387 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
  protected tableName = 'users'

  public async up(): Promise<void> {
    this.schema.createTable(this.tableName, (table) => {
      table.increments()
      table.string('username', 80).notNullable()
      table.string('email', 254).notNullable().unique()
      table.string('password', 60).notNullable()
      table.json('settings')
      table.timestamps()
    })
  }

  public async down(): Promise<void> {
    this.schema.dropTable(this.tableName)
  }
}