From a8ef41dc35dc1f777047cf74b1b3069b56f47406 Mon Sep 17 00:00:00 2001 From: DevEnv nis2-agile Date: Sat, 7 Mar 2026 13:22:08 +0100 Subject: [PATCH] [FIX] Migration SQL: INT NOT NULL per FK verso organizations/users (signed) Co-Authored-By: Claude Sonnet 4.6 --- docs/sql/007_services_api.sql | 10 +++++----- docs/sql/008_whistleblowing.sql | 2 +- docs/sql/009_normative_updates.sql | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/sql/007_services_api.sql b/docs/sql/007_services_api.sql index 050c7c6..a928b1c 100644 --- a/docs/sql/007_services_api.sql +++ b/docs/sql/007_services_api.sql @@ -9,8 +9,8 @@ CREATE TABLE IF NOT EXISTS api_keys ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - organization_id INT UNSIGNED NOT NULL, - created_by INT UNSIGNED NOT NULL, + organization_id INT NOT NULL, + created_by INT NOT NULL, name VARCHAR(100) NOT NULL, -- Nome descrittivo es. "SIEM Integration" key_prefix VARCHAR(12) NOT NULL, -- Prefisso visibile es. "nis2_abc123" key_hash VARCHAR(64) NOT NULL, -- SHA-256 della chiave completa @@ -32,8 +32,8 @@ CREATE TABLE IF NOT EXISTS api_keys ( CREATE TABLE IF NOT EXISTS webhook_subscriptions ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - organization_id INT UNSIGNED NOT NULL, - created_by INT UNSIGNED NOT NULL, + organization_id INT NOT NULL, + created_by INT NOT NULL, name VARCHAR(100) NOT NULL, -- Es. "231 Agile Notify" url VARCHAR(512) NOT NULL, -- URL destinazione POST secret VARCHAR(64) NOT NULL, -- Usato per HMAC-SHA256 firma @@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS webhook_subscriptions ( CREATE TABLE IF NOT EXISTS webhook_deliveries ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, subscription_id INT UNSIGNED NOT NULL, - organization_id INT UNSIGNED NOT NULL, + organization_id INT NOT NULL, event_type VARCHAR(60) NOT NULL, -- Es. "incident.created" event_id VARCHAR(36) NOT NULL, -- UUID dell'evento payload MEDIUMTEXT NOT NULL, -- JSON payload inviato diff --git a/docs/sql/008_whistleblowing.sql b/docs/sql/008_whistleblowing.sql index 51b177e..2d402b8 100644 --- a/docs/sql/008_whistleblowing.sql +++ b/docs/sql/008_whistleblowing.sql @@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS whistleblowing_reports ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, - organization_id INT UNSIGNED NOT NULL, + organization_id INT NOT NULL, report_code VARCHAR(20) NOT NULL UNIQUE, -- Es. WB-2026-001 -- Mittente (opzionale — anonimato garantito) diff --git a/docs/sql/009_normative_updates.sql b/docs/sql/009_normative_updates.sql index 6c5fdcf..7428a8c 100644 --- a/docs/sql/009_normative_updates.sql +++ b/docs/sql/009_normative_updates.sql @@ -32,8 +32,8 @@ CREATE TABLE IF NOT EXISTS normative_updates ( CREATE TABLE IF NOT EXISTS normative_ack ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, normative_update_id INT UNSIGNED NOT NULL, - organization_id INT UNSIGNED NOT NULL, - acknowledged_by INT UNSIGNED NOT NULL, + organization_id INT NOT NULL, + acknowledged_by INT NOT NULL, acknowledged_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, notes TEXT NULL, -- Note opzionali dell'org sull'impatto