tarakan/priv/repo/migrations/20260711192216_create_ssh_keys.exs
Maxfield Luke af6077b9c3
All checks were successful
CI and deploy / Test (push) Successful in 4m52s
CI and deploy / Deploy production (push) Successful in 23s
Initial commit on Forgejo
Fresh repository history for elektrine/tarakan hosted at
https://git.elektrine.com/elektrine/tarakan.
2026-07-29 04:43:40 -04:00

21 lines
714 B
Elixir

defmodule Tarakan.Repo.Migrations.CreateSshKeys do
use Ecto.Migration
def change do
create table(:ssh_keys) do
add :account_id, references(:accounts, on_delete: :delete_all), null: false
add :name, :string, null: false
add :key_type, :string, null: false
add :public_key, :text, null: false
add :fingerprint_sha256, :string, null: false
add :last_used_at, :utc_datetime_usec
timestamps(type: :utc_datetime_usec)
end
# Global uniqueness is load-bearing: SSH authentication resolves a
# presented key to exactly one account by fingerprint.
create unique_index(:ssh_keys, [:fingerprint_sha256])
create index(:ssh_keys, [:account_id])
end
end