defmodule GitGud.Repo.Migrations.AddFederatedPrOrigin do
use Ecto.Migration
def change do
alter table(:pull_requests) do
# Remote AP actor that offered this PR. NULL for local-origin PRs.
add :source_actor_id, references(:actors, on_delete: :nilify_all)
# The Offer activity URL. Unique so we can idempotently re-process
# a re-delivered Offer without creating duplicate PRs.
add :activity_url, :text
# Git URL we fetched the source branch from. Stored so future
# Update activities can re-fetch without re-resolving via AP.
add :source_clone_url, :text
end
create unique_index(:pull_requests, [:activity_url],
where: "activity_url IS NOT NULL",
name: :pull_requests_activity_url_index
)
create index(:pull_requests, [:source_actor_id])
end
end
857 B · text
5af55d9