Add missing indices

A lot of indices through whole DB were missing. While some of them are
overlapping with existing mutlicolumn indices the order of columns is
wrong, as most specific ones are first and least specific (and by that
most used) are last which mean that DB cannot use them in queries.
This commit is contained in:
Łukasz Jan Niemier 2018-04-26 11:04:31 +02:00 committed by Simon Prévost
parent 22b70541c0
commit 18fd1a4d2e

View File

@ -0,0 +1,40 @@
defmodule Accent.Repo.Migrations.AddMissingIndices do
use Ecto.Migration
def change do
create index(:auth_access_tokens, [:user_id], where: "revoked_at IS NULL")
create index(:auth_providers, [:user_id])
create index(:comments, [:user_id])
create index(:comments, [:translation_id])
create index(:documents, [:project_id])
create index(:integrations, [:project_id])
create index(:integrations, [:user_id])
create index(:operations, [:translation_id])
create index(:operations, [:revision_id])
create index(:operations, [:project_id])
create index(:operations, [:comment_id])
create index(:operations, [:batch_operation_id])
create index(:operations, [:rollbacked_operation_id])
create index(:operations, [:user_id])
create index(:operations, [:document_id])
create index(:operations, [:version_id])
create index(:projects, [:language_id])
create index(:revisions, [:project_id])
create index(:revisions, [:language_id])
create index(:revisions, [:master_revision_id])
create index(:translations, [:document_id])
create index(:translations, [:version_id])
create index(:translations, [:source_translation_id])
create index(:versions, [:project_id])
create index(:versions, [:user_id])
end
end