bac53972cfb6c778e5f9c0b3a6cda523a0222042
[akkoma] / priv / repo / migrations / 20171109091239_add_actor_to_activity.exs
1 defmodule Pleroma.Repo.Migrations.AddActorToActivity do
2 use Ecto.Migration
3
4 @disable_ddl_transaction true
5
6 def up do
7 alter table(:activities) do
8 add :actor, :string
9 end
10
11 execute """
12 update activities set actor = data->>'actor';
13 """
14
15 create index(:activities, [:actor, "id DESC NULLS LAST"], concurrently: true)
16 end
17
18 def down do
19 drop index(:activities, [:actor, "id DESC NULLS LAST"])
20 alter table(:activities) do
21 remove :actor
22 end
23 end
24 end