mirror of
https://github.com/sergeyyarkov/educt-server.git
synced 2026-10-11 02:09:07 +03:00
25 lines
784 B
TypeScript
25 lines
784 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.string('id', 21).primary();
|
|
table.string('first_name', 24).notNullable();
|
|
table.string('last_name', 24).notNullable();
|
|
table.text('about');
|
|
table.string('login', 128).notNullable().unique();
|
|
table.string('email').notNullable().unique();
|
|
table.string('password').notNullable();
|
|
table.timestamp('last_login', { useTz: true });
|
|
table.timestamp('created_at', { useTz: true });
|
|
table.timestamp('updated_at', { useTz: true });
|
|
});
|
|
}
|
|
|
|
public async down() {
|
|
this.schema.dropTable(this.tableName);
|
|
}
|
|
}
|