2022-02-26 06:11:42 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-01 11:11:47 +00:00
|
|
|
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
2022-02-26 06:11:42 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2017-05-22 16:10:50 +00:00
|
|
|
defmodule Pleroma.Repo.Migrations.CaseInsensivtivity do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
2019-07-03 11:56:02 +00:00
|
|
|
# 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.
|
|
|
|
|
2017-05-22 16:10:50 +00:00
|
|
|
def up do
|
2019-07-02 22:14:40 +00:00
|
|
|
execute("create extension if not exists citext")
|
|
|
|
|
2017-05-22 16:10:50 +00:00
|
|
|
alter table(:users) do
|
2019-07-02 22:14:40 +00:00
|
|
|
modify(:email, :citext)
|
2017-05-22 16:10:50 +00:00
|
|
|
end
|
2019-07-02 22:14:40 +00:00
|
|
|
|
2019-07-03 11:56:02 +00:00
|
|
|
alter table(:users) do
|
|
|
|
modify(:nickname, :citext)
|
|
|
|
end
|
2017-05-22 16:10:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
alter table(:users) do
|
2019-07-02 22:14:40 +00:00
|
|
|
modify(:email, :string)
|
2019-07-03 11:56:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
alter table(:users) do
|
2019-07-02 22:14:40 +00:00
|
|
|
modify(:nickname, :string)
|
2017-05-22 16:10:50 +00:00
|
|
|
end
|
2019-07-02 22:14:40 +00:00
|
|
|
|
|
|
|
execute("drop extension if exists citext")
|
2017-05-22 16:10:50 +00:00
|
|
|
end
|
|
|
|
end
|