prop/priv/repo/migrations/20260409175343_add_user_id_to_contacts.exs
Graham McIntire 5724b33e8f Link submissions to the logged-in user on /submit
Contacts now carry a user_id FK to users. When a logged-in user
submits a contact (single or CSV upload), the server injects their
user_id and the email from their account into the submission params,
and the visible email input is replaced with a hidden input holding
that value — logged-in users don't have to retype their address.

The submission changeset now requires at least one of user_id or
submitter_email (rather than hard-requiring email), and email format
is only validated when one is actually present.

Reworded the submit-page blurb from "10 GHz to 241 GHz" to "902 MHz
and up" so it matches the actual band coverage of the project.
2026-04-09 13:01:49 -05:00

11 lines
271 B
Elixir

defmodule Microwaveprop.Repo.Migrations.AddUserIdToContacts do
use Ecto.Migration
def change do
alter table(:contacts) do
add :user_id, references(:users, type: :binary_id, on_delete: :nilify_all)
end
create index(:contacts, [:user_id])
end
end