Ensure we have no duplicate ap ids.
authorRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 12:54:58 +0000 (14:54 +0200)
committerRoger Braun <roger@rogerbraun.net>
Mon, 1 May 2017 12:54:58 +0000 (14:54 +0200)
priv/repo/migrations/20170501124823_add_id_contraints_to_activities_and_objects.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20170501124823_add_id_contraints_to_activities_and_objects.exs b/priv/repo/migrations/20170501124823_add_id_contraints_to_activities_and_objects.exs
new file mode 100644 (file)
index 0000000..21534ad
--- /dev/null
@@ -0,0 +1,8 @@
+defmodule Pleroma.Repo.Migrations.AddIdContraintsToActivitiesAndObjects do
+  use Ecto.Migration
+
+  def change do
+    create index(:objects, ["(data->>\"id\")"], name: :objects_unique_apid_index)
+    create index(:activities, ["(data->>\"id\")"], name: :activities_unique_apid_index)
+  end
+end