Use execute to drop indexes and builder to create indexes

This commit is contained in:
itepechi 2023-11-02 06:23:36 +09:00
parent ecc8f28fc0
commit 01bdebb03f
1 changed files with 6 additions and 8 deletions

View File

@ -2,18 +2,16 @@ defmodule Pleroma.Repo.Migrations.CreatePgroongaIndex do
use Ecto.Migration
def up do
execute("DROP INDEX IF EXISTS objects_fts")
execute("CREATE EXTENSION IF NOT EXISTS pgroonga")
drop_if_exists(
index(:objects, ["(to_tsvector('english', data->>'content'))"],
using: :gin,
name: :objects_fts
create_if_not_exists(
index(:objects, ["(data->'content') pgroonga_jsonb_full_text_search_ops_v2"],
using: :pgroonga,
name: :object_content_pgroonga
)
)
execute(
"CREATE INDEX object_content_pgroonga ON objects USING pgroonga ((data->'content') pgroonga_jsonb_full_text_search_ops_v2)"
)
end
def down do