From 0d7109254b82ffd1b31c6e90ea3fa2a80f9783c0 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 9 Oct 2019 16:55:58 +0200 Subject: [PATCH] Migrations: Create index after filling up the db. --- priv/repo/migrations/20191007123056_add_ap_id_column_to_objects.exs | 2 -- priv/repo/migrations/20191007160755_fill_object_ap_id_field.exs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/priv/repo/migrations/20191007123056_add_ap_id_column_to_objects.exs b/priv/repo/migrations/20191007123056_add_ap_id_column_to_objects.exs index fb38fa29c..c0548b6d6 100644 --- a/priv/repo/migrations/20191007123056_add_ap_id_column_to_objects.exs +++ b/priv/repo/migrations/20191007123056_add_ap_id_column_to_objects.exs @@ -5,7 +5,5 @@ defmodule Pleroma.Repo.Migrations.AddApIdColumnToObjects do alter table(:objects) do add :ap_id, :string end - - create unique_index(:objects, [:ap_id]) end end diff --git a/priv/repo/migrations/20191007160755_fill_object_ap_id_field.exs b/priv/repo/migrations/20191007160755_fill_object_ap_id_field.exs index 55834b3e1..81ecc27f7 100644 --- a/priv/repo/migrations/20191007160755_fill_object_ap_id_field.exs +++ b/priv/repo/migrations/20191007160755_fill_object_ap_id_field.exs @@ -3,5 +3,6 @@ defmodule Pleroma.Repo.Migrations.FillObjectApIdField do def change do execute("update objects set ap_id = data->>'id'") + create unique_index(:objects, [:ap_id]) end end