All files / services/user/migrations 20200105194249_userToken.ts

0% Statements 0/21
100% Branches 0/0
0% Functions 0/3
0% Lines 0/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                                           
import * as Knex from "knex";
 
export async function up(knex: Knex): Promise<any> {
  await knex.schema.createTable("user_tokens", table => {
    table.string("id").primary();
    table.string("userId").notNullable();
    table.string("accessToken").notNullable();
    table.string("refreshToken").notNullable();
    table.string("type").notNullable();
    table.json("scope").notNullable();
    table.string("appId").nullable();
    table.json("meta").notNullable();
 
    table.dateTime("expiresAt").nullable();
    table.dateTime("deletedAt").nullable();
    table.dateTime("updatedAt").notNullable();
    table.dateTime("createdAt").notNullable();
 
    table.index(["userId"]);
    table.index(["accessToken"]);
    table.index(["refreshToken"]);
    table.index(["type"]);
    table.index(["appId"]);
  });
}
 
export async function down(knex: Knex): Promise<any> {
  return knex.schema.dropTable("user_tokens");
}