diff --git a/source/migrations/20210122184357_users_index.ts b/source/migrations/20210122184357_users_index.ts new file mode 100644 index 00000000000..bedf42444c0 --- /dev/null +++ b/source/migrations/20210122184357_users_index.ts @@ -0,0 +1,15 @@ +import * as Knex from 'knex'; + +export async function up(knex: Knex): Promise { + knex.schema.alterTable('users', function (t) { + t.unique(['user_id']); + t.index(['user_id', 'lang']); + }); +} + +export async function down(knex: Knex): Promise { + knex.schema.alterTable('users', function (t) { + t.dropUnique(['user_id']); + t.dropIndex(['user_id', 'lang']); + }); +}