-- Migration 2026-04-18 : table tour de garde SecOps
BEGIN;

CREATE TABLE IF NOT EXISTS secops_duty (
    id              serial PRIMARY KEY,
    year            smallint NOT NULL,
    week_number     smallint NOT NULL,
    week_code       varchar(5) NOT NULL,
    week_start      date,
    week_end        date,
    absences        text,
    tdg_s1          varchar(50),
    tdg_symantec    varchar(50),
    tdg_m365        varchar(50),
    tdg_commvault   varchar(50),
    tdg_meteo       varchar(50),
    tdg_dmz         varchar(50),
    tdg_safenet     varchar(50),
    tdg_quarantaine varchar(50),
    tdg_securisation varchar(50),
    tdg_incident_majeur  varchar(50),
    tdg_incident_critique varchar(50),
    emails_dest     varchar(100),
    created_at      timestamptz DEFAULT now()
);

CREATE UNIQUE INDEX IF NOT EXISTS secops_duty_year_week_uniq ON secops_duty (year, week_number);
CREATE INDEX IF NOT EXISTS secops_duty_week_idx ON secops_duty (year, week_number);

COMMENT ON TABLE secops_duty IS 'Tour de garde SecOps hebdomadaire (source: Tour de garde secops_2026.xlsx)';

COMMIT;
