feat(server): metrics schema + context with record/latest/prune

This commit is contained in:
Carsten 2026-04-21 22:27:20 +02:00
parent 116f1ada14
commit 687fc17082
4 changed files with 153 additions and 0 deletions

View file

@ -0,0 +1,17 @@
defmodule Server.Repo.Migrations.CreateMetrics do
use Ecto.Migration
def change do
create table(:metrics) do
add :host_id, references(:hosts, on_delete: :delete_all), null: false
add :collected_at, :utc_datetime_usec, null: false
add :interval_type, :string, null: false
add :payload, :string, null: false
timestamps(type: :utc_datetime_usec, updated_at: false)
end
create index(:metrics, [:host_id, :collected_at])
create index(:metrics, [:collected_at])
end
end