forked from AkkomaGang/akkoma
Merge branch 'fix/migration-alter-citext-field-with-key' into 'develop'
Fix occasional migration failures See merge request pleroma/pleroma!1373
This commit is contained in:
commit
9b45feae9b
1 changed files with 18 additions and 6 deletions
|
@ -1,19 +1,31 @@
|
||||||
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")
|
||||||
|
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
modify :email, :citext
|
modify(:email, :citext)
|
||||||
modify :nickname, :citext
|
end
|
||||||
|
|
||||||
|
alter table(:users) do
|
||||||
|
modify(:nickname, :citext)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def down do
|
def down do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
modify :email, :string
|
modify(:email, :string)
|
||||||
modify :nickname, :string
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alter table(:users) do
|
||||||
|
modify(:nickname, :string)
|
||||||
|
end
|
||||||
|
|
||||||
execute("drop extension if exists citext")
|
execute("drop extension if exists citext")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue