blob: e8613a10f71e01231163993fb0a46633a4a0f66d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
defmodule MatrixAppService.Bridge.Room do
@moduledoc """
Schema and helpers for keeping track of room correspondence.
"""
use Ecto.Schema
import Ecto.Changeset
schema "rooms" do
field(:data, :map)
field(:local_id, :string)
field(:remote_id, :string)
timestamps()
end
@doc false
def changeset(room, attrs) do
room
|> cast(attrs, [:local_id, :remote_id, :data])
# |> validate_required([:local_id, :remote_id, :data])
|> unique_constraint(:local_id)
|> unique_constraint(:remote_id)
end
end
|