Ecto/Postgres/Phoenix set session variable on checkout connection

Have your worked with context and plugs?

This How i would approach this problem first create an Accounts context then use the Plug session:

and you can use this code to access the session:

defmodule HelloWeb.PageController do
  use HelloWeb, :controller

  def index(conn, _params) do
    conn = put_session(conn, :message, "new stuff we just set in the session")
    message = get_session(conn, :message)

    text conn, message
  end
end

No you can create a function to insert it into your table.

Also if you are new to phoenix the documentation may be a bit scary at first. So don’t be afraid to ask questions or clarifications on my response.

I will gladly try to help you, even though I am new to this framework too.