summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/bridge/user.ex
blob: aaa3c46e996983a02771d48f7ac4aea8d7d01db2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
defmodule MatrixAppService.Bridge.User do
  use Ecto.Schema
  import Ecto.Changeset

  schema "users" do
    field :data, :map
    field :local_id, :string
    field :remote_id, :string

    timestamps()
  end

  @doc false
  def changeset(user, attrs) do
    user
    |> cast(attrs, [:local_id, :remote_id, :data])
    # |> validate_required([:local_id, :remote_id, :data])
    |> unique_constraint(:local_id)
    |> unique_constraint(:remote_id)
  end
end