-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
priv/repo/migrations/20180426084509_add_missing_indices.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
11 changes: 11 additions & 0 deletions
11
priv/repo/migrations/20180426090527_add_trigram_indices_on_searchable_fields.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule Accent.Repo.Migrations.AddTrigramIndicesOnSearchableFields do | ||
use Ecto.Migration | ||
|
||
def change do | ||
execute("CREATE EXTENSION pg_trgm", "DROP EXTENSION pg_trgm") | ||
|
||
create index(:languages, ["name gin_trgm_ops"], using: :gin) | ||
create index(:projects, ["name gin_trgm_ops"], using: :gin) | ||
create index(:translations, ["key gin_trgm_ops", "corrected_text gin_trgm_ops"], using: :gin) | ||
end | ||
end |