30 lines
690 B
Elixir
30 lines
690 B
Elixir
|
defmodule Pleroma.Repo.Migrations.CreatePgroongaIndex do
|
||
|
use Ecto.Migration
|
||
|
|
||
|
def up do
|
||
|
execute("CREATE EXTENSION IF NOT EXISTS pgroonga")
|
||
|
|
||
|
drop_if_exists(
|
||
|
index(:objects, ["(to_tsvector('english', data->>'content'))"],
|
||
|
using: :gin,
|
||
|
name: :objects_fts
|
||
|
)
|
||
|
)
|
||
|
|
||
|
execute(
|
||
|
"CREATE INDEX object_content_pgroonga ON objects USING pgroonga ((data->'content')) WITH (tokenizer='TokenMecab')"
|
||
|
)
|
||
|
end
|
||
|
|
||
|
def down do
|
||
|
execute("DROP INDEX IF EXISTS object_content_pgroonga")
|
||
|
|
||
|
create_if_not_exists(
|
||
|
index(:objects, ["(to_tsvector('english', data->>'content'))"],
|
||
|
using: :gin,
|
||
|
name: :objects_fts
|
||
|
)
|
||
|
)
|
||
|
end
|
||
|
end
|