986 B · text 5af55d9
defmodule GitGud.Repo.Migrations.CreateSuggestedInstanceBlocks do
use Ecto.Migration
def change do
create table(:suggested_instance_blocks) do
add :host, :string, null: false, size: 250
# Aggregated reason strings from peers (newline-joined).
add :reasons, :text
# Hosts that blocked this one. We dedup by host so an operator
# can see "five peers blocked this".
add :peers, {:array, :string}, default: [], null: false
add :peer_count, :integer, null: false, default: 0
add :first_seen_at, :utc_datetime
add :last_seen_at, :utc_datetime
# pending | approved | dismissed
add :status, :string, null: false, default: "pending"
add :resolved_by_id, references(:users, on_delete: :nilify_all)
add :resolved_at, :utc_datetime
timestamps(type: :utc_datetime)
end
create unique_index(:suggested_instance_blocks, [:host])
create index(:suggested_instance_blocks, [:status])
end
end