Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
445B

  1. defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
  2. use Ecto.Migration
  3. def up do
  4. statement = """
  5. DELETE FROM
  6. activity_expirations a_exp USING activities a, objects o
  7. WHERE
  8. a_exp.activity_id = a.id AND (o.data->>'id') = COALESCE(a.data->'object'->>'id', a.data->>'object')
  9. AND (a.data->>'type' != 'Create' OR o.data->>'type' != 'Note');
  10. """
  11. execute(statement)
  12. end
  13. def down do
  14. :ok
  15. end
  16. end