Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions backend/migrations/071_recreate_ops_alert_silences.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- Recreate ops_alert_silences table.
--
-- Migration 037 used goose-style annotations (-- +goose Up / -- +goose Down),
-- but the project's migration runner does not parse goose directives.
-- It executed the entire file as plain SQL, including the Down section
-- (DROP TABLE IF EXISTS ops_alert_silences), which immediately destroyed
-- the table that the Up section had just created.
--
-- This migration recreates the table using IF NOT EXISTS for idempotency.

CREATE TABLE IF NOT EXISTS ops_alert_silences (
id BIGSERIAL PRIMARY KEY,

rule_id BIGINT NOT NULL,
platform VARCHAR(64) NOT NULL,
group_id BIGINT,
region VARCHAR(64),

until TIMESTAMPTZ NOT NULL,
reason TEXT,

created_by BIGINT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_ops_alert_silences_lookup
ON ops_alert_silences (rule_id, platform, group_id, region, until);