Skip to content

Commit

Permalink
Fix notification profiles silence_for column in sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
pijng committed Feb 18, 2025
1 parent 3fd187a commit 6b31885
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/schemas/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ CREATE TABLE IF NOT EXISTS notification_profiles (
description TEXT NOT NULL,
rule_ids TEXT,
enabled INTEGER DEFAULT 1,
silence_for INTEGER,
url TEXT,
method TEXT,
headers TEXT,
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/sqlite_adapter/notification_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *NotificationProfileStorage) UpdateNotificationProfileByID(ctx context.C

func (s *NotificationProfileStorage) GetAllNotificationProfiles(ctx context.Context) ([]*entities.NotificationProfile, error) {
query := `SELECT id, name, description, rule_ids, enabled, silence_for,
url, method, headers, payload FROM notification_profiles FROM notification_profiles ORDER BY id DESC;`
url, method, headers, payload FROM notification_profiles ORDER BY id DESC;`
stmt, err := s.readDB.PrepareContext(ctx, query)
if err != nil {
return nil, fmt.Errorf("failed preparing statement: %w", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE notification_profiles ADD COLUMN silence_for INTEGER;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TABLE notification_profiles ADD COLUMN silence_for;
-- +goose StatementEnd

0 comments on commit 6b31885

Please sign in to comment.