summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20170522160642_case_insensivtivity.exs
blob: eb72966e5b562971b261b6e6faa00afd5893167f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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

    :ok
  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