2022-02-26 06:11:42 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 20:38:50 +00:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2022-02-26 06:11:42 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-08 17:33:37 +00:00
|
|
|
defmodule Pleroma.Repo.Migrations.OnlyExpireCreates do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
|
|
|
statement = """
|
|
|
|
DELETE FROM
|
2020-08-12 09:41:47 +00:00
|
|
|
activity_expirations a_exp USING activities a, objects o
|
2020-08-08 17:33:37 +00:00
|
|
|
WHERE
|
2020-08-12 09:41:47 +00:00
|
|
|
a_exp.activity_id = a.id AND (o.data->>'id') = COALESCE(a.data->'object'->>'id', a.data->>'object')
|
|
|
|
AND (a.data->>'type' != 'Create' OR o.data->>'type' != 'Note');
|
2020-08-08 17:33:37 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
execute(statement)
|
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
end
|