2019-07-14 11:47:06 +00:00
|
|
|
defmodule Backend.Repo.Migrations.CreateInstances do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:instances) do
|
|
|
|
add :domain, :string, null: false
|
|
|
|
add :description, :text
|
|
|
|
add :user_count, :integer
|
|
|
|
add :status_count, :integer
|
|
|
|
add :version, :string
|
|
|
|
add :insularity, :float
|
|
|
|
|
2019-07-18 10:21:12 +00:00
|
|
|
add :x, :float
|
|
|
|
add :y, :float
|
|
|
|
|
2019-07-14 11:47:06 +00:00
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create unique_index(:instances, [:domain])
|
|
|
|
|
|
|
|
create table(:instance_peers) do
|
|
|
|
add :source_domain, references(:instances, column: :domain, type: :string)
|
|
|
|
add :target_domain, references(:instances, column: :domain, type: :string)
|
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create unique_index(:instance_peers, [:source_domain, :target_domain])
|
|
|
|
end
|
|
|
|
end
|