| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 28 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import BaseSchema from '@ioc:Adonis/Lucid/Schema' |
||
| 2 | |||
| 3 | export default class extends BaseSchema { |
||
| 4 | protected tableName = 'users' |
||
| 5 | |||
| 6 | public async up() { |
||
| 7 | this.schema.createTable(this.tableName, (table) => { |
||
| 8 | table.increments('id').primary() |
||
| 9 | table.string('name', 255).notNullable() |
||
| 10 | table.string('email', 255).notNullable().unique() |
||
| 11 | table.timestamp('email_verified_at', { useTz: true }).nullable() |
||
| 12 | table.string('password', 180).notNullable() |
||
| 13 | table.tinyint('is_merchant', 3).defaultTo(0) |
||
| 14 | table.string('remember_me_token').nullable() |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Uses timestampz for PostgreSQL and DATETIME2 for MSSQL |
||
| 18 | */ |
||
| 19 | table.timestamp('created_at', { useTz: true }).notNullable() |
||
| 20 | table.timestamp('updated_at', { useTz: true }).notNullable() |
||
| 21 | }) |
||
| 22 | } |
||
| 23 | |||
| 24 | public async down() { |
||
| 25 | this.schema.dropTable(this.tableName) |
||
| 26 | } |
||
| 27 | } |
||
| 28 |