diff options
Diffstat (limited to 'database/migrations/1503250034280_token.ts')
-rw-r--r-- | database/migrations/1503250034280_token.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/database/migrations/1503250034280_token.ts b/database/migrations/1503250034280_token.ts new file mode 100644 index 0000000..5a030d0 --- /dev/null +++ b/database/migrations/1503250034280_token.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import BaseSchema from '@ioc:Adonis/Lucid/Schema'; | ||
2 | |||
3 | export default class extends BaseSchema { | ||
4 | protected tableName = 'tokens'; | ||
5 | |||
6 | public async up(): Promise<void> { | ||
7 | this.schema.createTable(this.tableName, table => { | ||
8 | table.increments(); | ||
9 | table.integer('user_id').unsigned().references('users.id'); | ||
10 | table.string('token', 255).notNullable().unique().index(); | ||
11 | table.string('type', 80).notNullable(); | ||
12 | table.boolean('is_revoked').defaultTo(false); | ||
13 | table.timestamps(); | ||
14 | }); | ||
15 | } | ||
16 | |||
17 | public async down(): Promise<void> { | ||
18 | this.schema.dropTable(this.tableName); | ||
19 | } | ||
20 | } | ||