Skip to content

Commit 98d2d96

Browse files
committed
fix(storage): align nullable error kind and migration rollbacks
1 parent 7cadd5b commit 98d2d96

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

internal/repository/check/execution.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ INSERT INTO pulse.check_executions (
4747
details = data
4848
}
4949

50-
var errKind string
50+
var errKind *string
5151
if result.ErrorKind != e2.ErrNone {
52-
errKind = string(result.ErrorKind)
52+
errKind = new(result.ErrorKind.String())
5353
}
5454

5555
_, err := e.db.Exec(ctx, query,
@@ -62,7 +62,7 @@ INSERT INTO pulse.check_executions (
6262
result.FinishedAt,
6363
result.Duration.Microseconds(),
6464
result.AttemptsTotal,
65-
&errKind,
65+
errKind,
6666
result.ErrorMessage,
6767
details,
6868
)
@@ -281,7 +281,7 @@ WITH params AS (
281281
CROSS JOIN params p
282282
WHERE e.service_id = p.service_id
283283
AND e.check_id = p.check_id
284-
AND e.observed_at <= b.bucket_end
284+
AND e.observed_at < b.bucket_end
285285
ORDER BY e.observed_at DESC, e.id DESC
286286
LIMIT 1
287287
) last_event ON TRUE

migrations/0004_check_executions.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ EXECUTE FUNCTION pulse.delete_prohibited();
3939
-- +goose Down
4040
DROP TRIGGER IF EXISTS check_executions_prohibit_delete ON pulse.check_executions;
4141
DROP TRIGGER IF EXISTS check_executions_prohibit_update ON pulse.check_executions;
42-
DROP INDEX IF EXISTS check_executions_service_id_idx;
43-
DROP INDEX IF EXISTS check_executions_check_id_idx;
44-
DROP INDEX IF EXISTS check_executions_execution_id_uidx;
42+
DROP INDEX IF EXISTS pulse.check_executions_service_id_idx;
43+
DROP INDEX IF EXISTS pulse.check_executions_check_id_idx;
44+
DROP INDEX IF EXISTS pulse.check_executions_execution_id_uidx;
4545
DROP TABLE IF EXISTS pulse.check_executions;

migrations/0005_check_states.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ EXECUTE FUNCTION pulse.delete_prohibited();
3434

3535
-- +goose Down
3636
DROP TRIGGER IF EXISTS check_states_prohibit_delete ON pulse.check_states;
37-
DROP INDEX IF EXISTS check_states_service_id_idx;
38-
DROP INDEX IF EXISTS check_states_check_id_idx;
37+
DROP INDEX IF EXISTS pulse.check_states_service_id_idx;
38+
DROP INDEX IF EXISTS pulse.check_states_check_id_idx;
3939
DROP TABLE IF EXISTS pulse.check_states;

migrations/0006_check_state_events.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ EXECUTE FUNCTION pulse.delete_prohibited();
4242
-- +goose Down
4343
DROP TRIGGER IF EXISTS check_state_events_prohibit_delete ON pulse.check_state_events;
4444
DROP TRIGGER IF EXISTS check_state_events_prohibit_update ON pulse.check_state_events;
45-
DROP INDEX IF EXISTS check_state_events_service_check_observed_id_idx;
45+
DROP INDEX IF EXISTS pulse.check_state_events_service_check_observed_id_idx;
4646
DROP TABLE IF EXISTS pulse.check_state_events;

0 commit comments

Comments
 (0)