summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/bridge/room.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/matrix_app_service/bridge/room.ex')
-rw-r--r--lib/matrix_app_service/bridge/room.ex21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/matrix_app_service/bridge/room.ex b/lib/matrix_app_service/bridge/room.ex
new file mode 100644
index 0000000..73ef1ea
--- /dev/null
+++ b/lib/matrix_app_service/bridge/room.ex
@@ -0,0 +1,21 @@
+defmodule MatrixAppService.Bridge.Room do
+ 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