forked from YokaiRick/akkoma
Split alters rather than work with indexes
This commit is contained in:
parent
291d95dcc3
commit
efefee8241
1 changed files with 10 additions and 4 deletions
|
@ -1,22 +1,28 @@
|
||||||
defmodule Pleroma.Repo.Migrations.CaseInsensivtivity do
|
defmodule Pleroma.Repo.Migrations.CaseInsensivtivity do
|
||||||
use Ecto.Migration
|
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
|
def up do
|
||||||
execute("create extension if not exists citext")
|
execute("create extension if not exists citext")
|
||||||
|
|
||||||
drop_if_exists(index(:users, [:email]))
|
|
||||||
|
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
modify(:email, :citext)
|
modify(:email, :citext)
|
||||||
modify(:nickname, :citext)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_if_not_exists(index(:users, [:email]))
|
alter table(:users) do
|
||||||
|
modify(:nickname, :citext)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down do
|
def down do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
modify(:email, :string)
|
modify(:email, :string)
|
||||||
|
end
|
||||||
|
|
||||||
|
alter table(:users) do
|
||||||
modify(:nickname, :string)
|
modify(:nickname, :string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue