bump_server/lib/bump/messages/message.ex
raphael 4e607a7e45 adds phoenix boilerplate and database api
- message communication added
- database migration added
- initial commit
2021-12-05 00:36:13 +01:00

21 lines
395 B
Elixir

defmodule Bump.Messages.Message do
use Ecto.Schema
import Ecto.Changeset
schema "messages" do
field :sender, :string
field :data, :string, default: ""
field :timestamp, :utc_datetime, default: DateTime.utc_now |> DateTime.truncate(:second)
timestamps()
end
def changeset(message, params) do
message
|> cast(params, [:sender, :data, :timestamp])
end
end