Merge branch 'account-notes' into 'develop'
[akkoma] / priv / repo / migrations / 20171109091239_add_actor_to_activity.exs
index bac53972cfb6c778e5f9c0b3a6cda523a0222042..91348f5c38f8c6d133a32437582d94dae0a30e25 100644 (file)
@@ -5,20 +5,17 @@ defmodule Pleroma.Repo.Migrations.AddActorToActivity do
 
   def up do
     alter table(:activities) do
-      add :actor, :string
+      add(:actor, :string)
     end
 
-    execute """
-      update activities set actor = data->>'actor';
-    """
-
-    create index(:activities, [:actor, "id DESC NULLS LAST"], concurrently: true)
+    create(index(:activities, [:actor, "id DESC NULLS LAST"], concurrently: true))
   end
 
   def down do
-    drop index(:activities, [:actor, "id DESC NULLS LAST"])
+    drop_if_exists(index(:activities, [:actor, "id DESC NULLS LAST"]))
+
     alter table(:activities) do
-      remove :actor
+      remove(:actor)
     end
   end
 end