mitgliederverwaltung/priv/repo/migrations/20250602071122_add_accounts_domain.exs

31 lines
842 B
Elixir

defmodule Mv.Repo.Migrations.AddAccountsDomain do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
rename table(:users), :password_hash, to: :hashed_password
alter table(:users) do
modify :email, :citext, null: false
modify :id, :uuid, default: fragment("gen_random_uuid()")
end
create unique_index(:users, [:email], name: "users_unique_email_index")
end
def down do
drop_if_exists unique_index(:users, [:email], name: "users_unique_email_index")
alter table(:users) do
modify :id, :uuid, default: fragment("uuid_generate_v7()")
modify :email, :text, null: true
end
rename table(:users), :hashed_password, to: :password_hash
end
end