feat(server): metrics schema + context with record/latest/prune
This commit is contained in:
parent
116f1ada14
commit
687fc17082
4 changed files with 153 additions and 0 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue