blob: 5a030d02cc15d8b584408e025c15803badd5e868 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import BaseSchema from '@ioc:Adonis/Lucid/Schema';
export default class extends BaseSchema {
protected tableName = 'tokens';
public async up(): Promise<void> {
this.schema.createTable(this.tableName, table => {
table.increments();
table.integer('user_id').unsigned().references('users.id');
table.string('token', 255).notNullable().unique().index();
table.string('type', 80).notNullable();
table.boolean('is_revoked').defaultTo(false);
table.timestamps();
});
}
public async down(): Promise<void> {
this.schema.dropTable(this.tableName);
}
}
|