This commit is contained in:
parent
883e7a3e62
commit
e7393e32d8
6 changed files with 344 additions and 2 deletions
42
priv/repo/migrations/20260220120000_add_join_requests.exs
Normal file
42
priv/repo/migrations/20260220120000_add_join_requests.exs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
defmodule Mv.Repo.Migrations.AddJoinRequests do
|
||||
@moduledoc """
|
||||
Adds join_requests table for public join flow (onboarding concept §2.3.2).
|
||||
"""
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
create table(:join_requests, primary_key: false) do
|
||||
add :id, :uuid, null: false, default: fragment("uuid_generate_v7()"), primary_key: true
|
||||
add :email, :string, null: false
|
||||
add :confirmation_token_hash, :string, null: false
|
||||
add :status, :string, null: false
|
||||
add :submitted_at, :utc_datetime_usec, null: false
|
||||
add :source, :string, null: false
|
||||
add :schema_version, :bigint, null: false
|
||||
add :payload, :map, null: true
|
||||
add :approved_at, :utc_datetime_usec, null: true
|
||||
add :rejected_at, :utc_datetime_usec, null: true
|
||||
add :reviewed_by_user_id, :uuid, null: true
|
||||
|
||||
add :inserted_at, :utc_datetime_usec,
|
||||
null: false,
|
||||
default: fragment("(now() AT TIME ZONE 'utc')")
|
||||
|
||||
add :updated_at, :utc_datetime_usec,
|
||||
null: false,
|
||||
default: fragment("(now() AT TIME ZONE 'utc')")
|
||||
end
|
||||
|
||||
create unique_index(:join_requests, [:confirmation_token_hash],
|
||||
name: "join_requests_unique_confirmation_token_hash_index"
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
drop_if_exists unique_index(:join_requests, [:confirmation_token_hash],
|
||||
name: "join_requests_unique_confirmation_token_hash_index"
|
||||
)
|
||||
|
||||
drop table(:join_requests)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue