Last active 1752988367

Revision 2828099d1f556028e91b5f75016e9f95e5457e67

ecto-migration-search-pg_trgm 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