educt-server/database/migrations/1626545059989_users.ts
2021-08-08 02:00:56 +03:00

23 lines
703 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.string('login', 128).notNullable().unique();
table.string('email').notNullable().unique();
table.string('password').notNullable();
table.timestamp('created_at', { useTz: true });
table.timestamp('updated_at', { useTz: true });
});
}
public async down() {
this.schema.dropTable(this.tableName);
}
}