Last active 1752988367

gaiety's Avatar gaiety revised this gist 1752988367. Go to revision

No changes

gaiety's Avatar gaiety revised this gist 1752988347. Go to revision

1 file changed, 0 insertions, 0 deletions

ecto-migration-search-pg_trgm renamed to ecto-migration-search-pg_trgm.exs

File renamed without changes

gaiety's Avatar gaiety revised this gist 1752988337. Go to revision

1 file changed, 21 insertions

ecto-migration-search-pg_trgm(file created)

@@ -0,0 +1,21 @@
1 + defmodule 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
21 + end
Newer Older