defmodule GitGud.Repo.Migrations.CreateLfsObjects do
use Ecto.Migration
def change do
create table(:lfs_objects) do
add :repository_id, references(:repositories, on_delete: :delete_all), null: false
# SHA-256 of the object content, as a 64-char lowercase hex string
# (the LFS spec exchanges these as hex, so we store them that way
# to avoid encode/decode at every endpoint).
add :oid, :string, null: false, size: 64
add :size, :bigint, null: false
add :storage_bucket, :string, null: false, size: 100
add :storage_key, :text, null: false
# Set when the client has finished uploading and called /verify.
# Until then the row is a placeholder; the storage object may
# not exist yet.
add :uploaded_at, :utc_datetime
timestamps(type: :utc_datetime)
end
create unique_index(:lfs_objects, [:repository_id, :oid])
create index(:lfs_objects, [:repository_id])
end
end
967 B · text
5af55d9