diff options
author | Wim Vanderbauwhede <wim.vanderbauwhede@mail.be> | 2019-02-14 16:41:40 +0000 |
---|---|---|
committer | Wim Vanderbauwhede <wim.vanderbauwhede@mail.be> | 2019-02-14 16:41:40 +0000 |
commit | 04b1c135543965860029557fc216eb38fd63b6c7 (patch) | |
tree | c1fb60376eeb35539704c23d282af7777895d4ea /priv/repo/migrations/20190118074940_fix_user_trigram_index.exs | |
parent | bf5b1c7f06c9f8882c40cf2385439bee3b74522c (diff) | |
parent | 1d17082ab2523eb75ee0ca4a49e45da0d0edabd7 (diff) | |
download | pleroma-04b1c135543965860029557fc216eb38fd63b6c7.tar.gz pleroma-04b1c135543965860029557fc216eb38fd63b6c7.zip |
Merge remote-tracking branch 'upstream/develop' into patch-image-description
Diffstat (limited to 'priv/repo/migrations/20190118074940_fix_user_trigram_index.exs')
-rw-r--r-- | priv/repo/migrations/20190118074940_fix_user_trigram_index.exs | 22 |
1 files changed, 22 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..b4e8c984c --- /dev/null +++ b/priv/repo/migrations/20190118074940_fix_user_trigram_index.exs @@ -0,0 +1,22 @@ +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 || ' ' || coalesce(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 |