594 B · text 5af55d9
defmodule GitGud.Repo.Migrations.CreateRegistryTokens do
use Ecto.Migration
def change do
create table(:registry_tokens) do
add :repository_id, references(:repositories, on_delete: :delete_all), null: false
add :name, :string, null: false
add :token_hash, :binary, null: false
add :scopes, {:array, :string}, null: false, default: ["pull"]
add :last_used_at, :utc_datetime
timestamps(type: :utc_datetime)
end
create unique_index(:registry_tokens, [:repository_id, :name])
create unique_index(:registry_tokens, [:token_hash])
end
end