aboutsummaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20170522160642_case_insensivtivity.exs
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations/20170522160642_case_insensivtivity.exs')
-rw-r--r--priv/repo/migrations/20170522160642_case_insensivtivity.exs35
1 files changed, 35 insertions, 0 deletions
diff --git a/priv/repo/migrations/20170522160642_case_insensivtivity.exs b/priv/repo/migrations/20170522160642_case_insensivtivity.exs
new file mode 100644
index 0000000..70f8dc6
--- /dev/null
+++ b/priv/repo/migrations/20170522160642_case_insensivtivity.exs
@@ -0,0 +1,35 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.CaseInsensivtivity do
+ use Ecto.Migration
+
+ # Two-steps alters are intentional.
+ # When alter of 2 columns is done in a single operation,
+ # inconsistent failures happen because of index on `email` column.
+
+ def up do
+ execute("create extension if not exists citext")
+
+ alter table(:users) do
+ modify(:email, :citext)
+ end
+
+ alter table(:users) do
+ modify(:nickname, :citext)
+ end
+ end
+
+ def down do
+ alter table(:users) do
+ modify(:email, :string)
+ end
+
+ alter table(:users) do
+ modify(:nickname, :string)
+ end
+
+ execute("drop extension if exists citext")
+ end
+end