Skip to content

Commit

Permalink
fix: add users user_id unique index
Browse files Browse the repository at this point in the history
  • Loading branch information
fengkx committed Jan 22, 2021
1 parent bda982d commit b95a9b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/migrations/20210122184357_users_index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as Knex from 'knex';

export async function up(knex: Knex): Promise<void> {
knex.schema.alterTable('users', function (t) {
t.unique(['user_id']);
t.index(['user_id', 'lang']);
});
}

export async function down(knex: Knex): Promise<void> {
knex.schema.alterTable('users', function (t) {
t.dropUnique(['user_id']);
t.dropIndex(['user_id', 'lang']);
});
}

0 comments on commit b95a9b0

Please sign in to comment.