Registered users can suggest edits to any contact's core fields (callsigns, grids, band, mode, timestamp). Edits enter an admin approval queue with field-by-field diff view. On approve, changes are applied and enrichment re-enqueued if grids/band changed. Users receive email notification on approve or reject. Also updates dependabot.yml for mix ecosystem.
25 lines
864 B
Elixir
25 lines
864 B
Elixir
defmodule Microwaveprop.Repo.Migrations.CreateContactEdits do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:contact_edits, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :contact_id, references(:contacts, type: :binary_id, on_delete: :delete_all),
|
|
null: false
|
|
|
|
add :user_id, references(:users, type: :binary_id, on_delete: :delete_all), null: false
|
|
add :proposed_changes, :map, null: false
|
|
add :status, :string, null: false, default: "pending"
|
|
add :admin_note, :string
|
|
add :reviewed_by_id, references(:users, type: :binary_id, on_delete: :nilify_all)
|
|
add :reviewed_at, :utc_datetime
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:contact_edits, [:contact_id])
|
|
create index(:contact_edits, [:user_id])
|
|
create index(:contact_edits, [:status])
|
|
end
|
|
end
|