Skip to content

Commit b95a9b0

Browse files
committed
fix: add users user_id unique index
1 parent bda982d commit b95a9b0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as Knex from 'knex';
2+
3+
export async function up(knex: Knex): Promise<void> {
4+
knex.schema.alterTable('users', function (t) {
5+
t.unique(['user_id']);
6+
t.index(['user_id', 'lang']);
7+
});
8+
}
9+
10+
export async function down(knex: Knex): Promise<void> {
11+
knex.schema.alterTable('users', function (t) {
12+
t.dropUnique(['user_id']);
13+
t.dropIndex(['user_id', 'lang']);
14+
});
15+
}

0 commit comments

Comments
 (0)