summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/migrations.ex
blob: 8b3c9f1e8b463a1ac77d22805d0ca48a9bec2075 (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
26
27
28
29
30
31
32
33
defmodule MatrixAppService.Migrations do
  @moduledoc """
  Module containing migrations for tables used in bridge mode. Should be used like this:

  TODO: example
  """

  use Ecto.Migration

  def change do
    create table(:users) do
      add(:local_id, :string)
      add(:remote_id, :string)
      add(:data, :map)

      timestamps()
    end

    create(unique_index(:users, [:local_id]))
    create(unique_index(:users, [:remote_id]))

    create table(:rooms) do
      add(:local_id, :string)
      add(:remote_id, :string)
      add(:data, :map)

      timestamps()
    end

    create(unique_index(:rooms, [:local_id]))
    create(unique_index(:rooms, [:remote_id]))
  end
end