diff options
| author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-09 21:21:09 +0300 |
|---|---|---|
| committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-09 21:21:09 +0300 |
| commit | 371d39e160efa51f2fe608e1788f6b11b89d9839 (patch) | |
| tree | b5dc6280d713f11392fd47bffd1a675b527162f5 /priv/repo/optional_migrations | |
| parent | d2cb18b2a342b990cc47dfdc42adb843c3db1b5e (diff) | |
| parent | 670a77ecbc94d57c6ecb5e569597e81cee4b5532 (diff) | |
| download | pleroma-371d39e160efa51f2fe608e1788f6b11b89d9839.tar.gz pleroma-371d39e160efa51f2fe608e1788f6b11b89d9839.zip | |
Merge develop
Diffstat (limited to 'priv/repo/optional_migrations')
| -rw-r--r-- | priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs index b6a24441a..6227769dc 100644 --- a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs +++ b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do return new; end $$ LANGUAGE plpgsql") - execute("create index objects_fts on objects using RUM (fts_content rum_tsvector_addon_ops, inserted_at) with (attach = 'inserted_at', to = 'fts_content');") + execute("create index if not exists objects_fts on objects using RUM (fts_content rum_tsvector_addon_ops, inserted_at) with (attach = 'inserted_at', to = 'fts_content');") execute("CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON objects FOR EACH ROW EXECUTE PROCEDURE objects_fts_update()") @@ -23,12 +23,12 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do end def down do - execute "drop index objects_fts" - execute "drop trigger tsvectorupdate on objects" - execute "drop function objects_fts_update()" + execute "drop index if exists objects_fts" + execute "drop trigger if exists tsvectorupdate on objects" + execute "drop function if exists objects_fts_update()" alter table(:objects) do remove(:fts_content, :tsvector) end - create index(:objects, ["(to_tsvector('english', data->>'content'))"], using: :gin, name: :objects_fts) + create_if_not_exists index(:objects, ["(to_tsvector('english', data->>'content'))"], using: :gin, name: :objects_fts) end end |
