defmodule GitGud.Repo.Migrations.CreateRepositoryRoots do
use Ecto.Migration
# A repo's parentless commits are its lineage fingerprint. Two repos
# sharing one are forks of each other however the copy was made — so
# this finds forks whose `parent_repository_id` link was never set
# (imports) or was severed.
def change do
create table(:repository_roots) do
add :repository_id, references(:repositories, on_delete: :delete_all), null: false
add :sha, :binary, null: false
timestamps(type: :utc_datetime, updated_at: false)
end
create unique_index(:repository_roots, [:repository_id, :sha])
# The lookup that matters: "who else shares this root?"
create index(:repository_roots, [:sha])
end
end
neiam /gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Packages
⭐
Log in to mark this repository.
752 B · text
History
6280797