Revert citext user URI migration
authorrinpatch <rinpatch@sdf.org>
Mon, 28 Sep 2020 15:15:31 +0000 (18:15 +0300)
committerrinpatch <rinpatch@sdf.org>
Mon, 28 Sep 2020 15:34:03 +0000 (18:34 +0300)
URI paths are not actually case-insesitive, which caused migration issues
 on a number of databases.

Closes #2188

priv/repo/migrations/20200925065249_make_user_ids_ci.exs
priv/repo/migrations/20200928145912_revert_citext_change.exs [new file with mode: 0644]
test/user_search_test.exs

index b7305f137ac31274b73cfbb914ebf4f625ff8b6e..8ea0f2cf13aad156eab5dc5f6d785a76fe3e4259 100644 (file)
@@ -1,19 +1,9 @@
 defmodule Pleroma.Repo.Migrations.MakeUserIdsCI do
   use Ecto.Migration
 
-  def up do
-    alter table(:users) do
-      modify(:uri, :citext)
-    end
-
-    create(unique_index(:users, :uri))
-  end
-
-  def don do
-    drop(unique_index(:users, :uri))
-
-    alter table(:users) do
-      modify(:uri, :text)
-    end
+  def change do
+    # Migration retired, see
+    # https://git.pleroma.social/pleroma/pleroma/-/issues/2188
+    :noop
   end
 end
diff --git a/priv/repo/migrations/20200928145912_revert_citext_change.exs b/priv/repo/migrations/20200928145912_revert_citext_change.exs
new file mode 100644 (file)
index 0000000..ab232f6
--- /dev/null
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.RevertCitextChange do
+  use Ecto.Migration
+
+  def change do
+    alter table(:users) do
+      modify(:uri, :text)
+    end
+
+    create_if_not_exists(unique_index(:users, :uri))
+  end
+end
index b99a77b579842019e1e6e297559586800e4fa288..cc14e97415547bb1bbffbb58c263473e712dbf89 100644 (file)
@@ -41,7 +41,7 @@ defmodule Pleroma.UserSearchTest do
         insert(:user, %{
           nickname: "no_relation",
           ap_id: "https://lain.com/users/lain",
-          uri: "https://lain.com/@Lain"
+          uri: "https://lain.com/@lain"
         })
 
       _user = insert(:user, %{nickname: "com_user"})