376b455e7a25bc859a1bb92a021c5de8d0def92b
[anni] / priv / repo / migrations / 20190511191044_set_default_state_to_reports.exs
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
5 defmodule Pleroma.Repo.Migrations.SetDefaultStateToReports do
6   use Ecto.Migration
7
8   def up do
9     execute("""
10       UPDATE activities AS a
11       SET data = jsonb_set(data, '{state}', '"open"', true)
12       WHERE data->>'type' = 'Flag'
13     """)
14   end
15
16   def down do
17     execute("""
18       UPDATE activities AS a
19       SET data = data #- '{state}'
20       WHERE data->>'type' = 'Flag'
21     """)
22   end
23 end