26 lines
675 B
TypeScript
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)
|
|
}
|
|
}
|