logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

20200808173046_only_expire_creates.exs (604B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
  5. use Ecto.Migration
  6. def up do
  7. statement = """
  8. DELETE FROM
  9. activity_expirations a_exp USING activities a, objects o
  10. WHERE
  11. a_exp.activity_id = a.id AND (o.data->>'id') = COALESCE(a.data->'object'->>'id', a.data->>'object')
  12. AND (a.data->>'type' != 'Create' OR o.data->>'type' != 'Note');
  13. """
  14. execute(statement)
  15. end
  16. def down do
  17. :ok
  18. end
  19. end