Add GIN indexes for attributes which used to search.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
defmodule DecentralisedBookIndex.Repo.Migrations.AddGinIndexes do
|
||||
@moduledoc """
|
||||
Updates resources based on their most recent snapshots.
|
||||
|
||||
This file was autogenerated with `mix ash_postgres.generate_migrations`
|
||||
"""
|
||||
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
execute("CREATE EXTENSION IF NOT EXISTS \"pg_trgm\"")
|
||||
|
||||
create index(:publishers, ["name gin_trgm_ops"],
|
||||
name: "publisher_name_gin_index",
|
||||
using: "GIN"
|
||||
)
|
||||
|
||||
create index(:dbi_servers, ["name gin_trgm_ops"], name: "server_name_gin_index", using: "GIN")
|
||||
|
||||
create index(:books, ["title gin_trgm_ops"], name: "book_title_gin_index", using: "GIN")
|
||||
|
||||
create index(:book_ids, ["bid gin_trgm_ops"], name: "book_id_bid_gin_index", using: "GIN")
|
||||
|
||||
create index(:book_ids, ["type gin_trgm_ops"], name: "book_id_type_gin_index", using: "GIN")
|
||||
|
||||
create index(:authors, ["name gin_trgm_ops"], name: "author_name_gin_index", using: "GIN")
|
||||
end
|
||||
|
||||
def down do
|
||||
drop_if_exists index(:authors, ["name gin_trgm_ops"], name: "author_name_gin_index")
|
||||
|
||||
drop_if_exists index(:book_ids, ["type gin_trgm_ops"], name: "book_id_type_gin_index")
|
||||
|
||||
drop_if_exists index(:book_ids, ["bid gin_trgm_ops"], name: "book_id_bid_gin_index")
|
||||
|
||||
drop_if_exists index(:books, ["title gin_trgm_ops"], name: "book_title_gin_index")
|
||||
|
||||
drop_if_exists index(:dbi_servers, ["name gin_trgm_ops"], name: "server_name_gin_index")
|
||||
|
||||
drop_if_exists index(:publishers, ["name gin_trgm_ops"], name: "publisher_name_gin_index")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user