Users or media owners?

Our user-management functions aren't related to storage per se, so we will encapsulate them inside a new ElixirDrip.Accounts context. Naturally, the User schema that we'll create will also live there:

$ cat apps/elixir_drip/lib/elixir_drip/accounts/user.exdefmodule ElixirDrip.Accounts.User do  use Ecto.Schema  import Ecto.Changeset  alias __MODULE__  @primary_key {:id, ElixirDrip.Ecto.Ksuid, autogenerate: true}  schema "users" do    field :username, :string    field :hashed_password, :string    field :password, :string, virtual: true    field :email, :string    timestamps()  end  # ...end

Pretty similarly to what we already did for the Media schema, the User schema is also identified by a KSUID. Besides id, this schema also has four string ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.