feat: add chat schema and migration
This commit is contained in:
18
lib/slax/chat/room.ex
Normal file
18
lib/slax/chat/room.ex
Normal file
@@ -0,0 +1,18 @@
|
||||
defmodule Slax.Chat.Room do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
schema "rooms" do
|
||||
field :name, :string
|
||||
field :topic, :string
|
||||
|
||||
timestamps(type: :utc_datetime)
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(room, attrs) do
|
||||
room
|
||||
|> cast(attrs, [:name, :topic])
|
||||
|> validate_required([:name, :topic])
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user