diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-01-18 10:57:42 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-01-18 10:57:42 +0300 |
commit | 79e44042bc08cf69274008e408cac912ae693afe (patch) | |
tree | 9991feadc3d82f94cbc11e074537875b63fb2968 /priv/repo/migrations/20190118074940_fix_user_trigram_index.exs | |
parent | ed8f55ab8eb292903cec8f7699aa6775cc304458 (diff) | |
download | pleroma-79e44042bc08cf69274008e408cac912ae693afe.tar.gz pleroma-79e44042bc08cf69274008e408cac912ae693afe.zip |
[#477] User trigram index adjustment.
Diffstat (limited to 'priv/repo/migrations/20190118074940_fix_user_trigram_index.exs')
-rw-r--r-- | priv/repo/migrations/20190118074940_fix_user_trigram_index.exs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs b/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs new file mode 100644 index 000000000..4f7712eb0 --- /dev/null +++ b/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs @@ -0,0 +1,13 @@ +defmodule Pleroma.Repo.Migrations.FixUserTrigramIndex do + use Ecto.Migration + + def up do + drop_if_exists index(:users, [], name: :users_trigram_index) + create index(:users, ["(trim(nickname || ' ' || name)) gist_trgm_ops"], name: :users_trigram_index, using: :gist) + end + + def down do + drop_if_exists index(:users, [], name: :users_trigram_index) + create index(:users, ["(nickname || name) gist_trgm_ops"], name: :users_trigram_index, using: :gist) + end +end |