Last active 1752988367

Revision f86771a1bb305a857087941ea368631ff2be71fd

ecto-migration-search-pg_trgm.exs Raw
1defmodule MyProject.Repo.Migrations.ItemsSearch do
2 use Ecto.Migration
3
4 def up do
5 execute "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
6
7 execute """
8 CREATE INDEX items_search_index
9 ON items
10 USING gin ((name) gin_trgm_ops);
11 """
12 end
13
14 def down do
15 execute """
16 DROP INDEX IF EXISTS items_search_index;
17 """
18
19 execute "DROP EXTENSION IF EXISTS pg_trgm;"
20 end
21end