comfycamp/priv/repo/migrations/20241005121850_add_usernames.exs

18 lines
313 B
Elixir

defmodule Comfycamp.Repo.Migrations.AddUsernames do
use Ecto.Migration
def change do
alter table(:users) do
add :username, :citext
end
execute("""
UPDATE users
SET username = email
""")
alter table(:users) do
modify :username, :citext, null: false
end
end
end