mirror of
https://github.com/mirego/accent.git
synced 2024-11-10 10:09:21 +03:00
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:
parent
22b70541c0
commit
18fd1a4d2e
40
priv/repo/migrations/20180426084509_add_missing_indices.exs
Normal file
40
priv/repo/migrations/20180426084509_add_missing_indices.exs
Normal 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
|
Loading…
Reference in New Issue
Block a user