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

19 lines
313 B
Elixir
Raw Normal View History

2024-10-05 17:51:21 +05:00
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