diff options
author | Ilja <domainepublic@spectraltheorem.be> | 2021-01-10 13:17:04 +0100 |
---|---|---|
committer | Ilja <domainepublic@spectraltheorem.be> | 2021-01-10 13:17:04 +0100 |
commit | 7ab524b899ea9bc746952ed4fc363ae0f11ecb56 (patch) | |
tree | f2f91a6cf7a4d1d30ecbd3607029417fbec598f6 /priv | |
parent | 95d5589df63b22927bfc062a46b6d132cdba37c9 (diff) | |
parent | be7a76abc064ce49d18cb1639e875d7b92b6b690 (diff) | |
download | pleroma-7ab524b899ea9bc746952ed4fc363ae0f11ecb56.tar.gz |
Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into simplePolicy_reasons_for_instance_specific_policies
Diffstat (limited to 'priv')
-rw-r--r-- | priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs | 29 |
1 files changed, 23 insertions, 6 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 757afa129..82e02281d 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 @@ -3,7 +3,14 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do def up do execute("create extension if not exists rum") - drop_if_exists index(:objects, ["(to_tsvector('english', data->>'content'))"], using: :gin, name: :objects_fts) + + drop_if_exists( + index(:objects, ["(to_tsvector('english', data->>'content'))"], + using: :gin, + name: :objects_fts + ) + ) + alter table(:objects) do add(:fts_content, :tsvector) end @@ -14,7 +21,10 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do return new; end $$ LANGUAGE plpgsql") - 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 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 +33,19 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do end def down do - execute "drop index if exists objects_fts" - execute "drop trigger if exists tsvectorupdate on objects" - execute "drop function if exists 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_if_not_exists 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 |