Actually make index unique.
authorRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 13:42:05 +0000 (15:42 +0200)
committerRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 13:42:05 +0000 (15:42 +0200)
priv/repo/migrations/20170501133231_add_id_contraints_to_activities_and_objects_part_two.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20170501133231_add_id_contraints_to_activities_and_objects_part_two.exs b/priv/repo/migrations/20170501133231_add_id_contraints_to_activities_and_objects_part_two.exs
new file mode 100644 (file)
index 0000000..12eea13
--- /dev/null
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjectsPartTwo do
+  use Ecto.Migration
+
+  def change do
+    drop index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
+    drop index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
+    create unique_index(:objects, ["(data->>'id')"], name: :objects_unique_apid_index)
+    create unique_index(:activities, ["(data->>'id')"], name: :activities_unique_apid_index)
+  end
+end