-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
will be used to persist resolution info in alerts, whcih can then be vector indexed to aid in further debugging efforts.
- Loading branch information
1 parent
4ace586
commit e0721a4
Showing
8 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule Console.Schema.AlertResolution do | ||
use Piazza.Ecto.Schema | ||
alias Console.Schema.{Alert} | ||
schema "alert_resolutions" do | ||
field :resolution, :string | ||
|
||
belongs_to :alert, Alert | ||
|
||
timestamps() | ||
end | ||
|
||
@valid ~w(alert_id resolution)a | ||
|
||
def changeset(model, attrs \\ %{}) do | ||
model | ||
|> cast(attrs, @valid) | ||
|> foreign_key_constraint(:alert_id) | ||
|> unique_constraint(:alert_id) | ||
|> validate_required([:resolution]) | ||
end | ||
end |
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
priv/repo/migrations/20250226224105_add_alert_resolutions.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Console.Repo.Migrations.AddAlertResolutions do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:alert_resolutions, primary_key: false) do | ||
add :id, :uuid, primary_key: true | ||
add :alert_id, references(:alerts, type: :uuid, on_delete: :delete_all) | ||
add :resolution, :binary | ||
|
||
timestamps() | ||
end | ||
|
||
create unique_index(:alert_resolutions, [:alert_id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters