Files
duty-schedule-api/database/migrations/1634414150546_users.ts
2021-10-16 23:19:50 +02:00

26 lines
675 B
TypeScript

import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Users extends BaseSchema {
protected tableName = 'users'
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 })
table.string('username').notNullable().unique()
table.string('email').notNullable().unique()
table.string('password').notNullable()
})
}
public async down () {
this.schema.dropTable(this.tableName)
}
}