[FIX] Migration SQL: INT NOT NULL per FK verso organizations/users (signed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
DevEnv nis2-agile
2026-03-07 13:22:08 +01:00
co-authored by Claude Sonnet 4.6
parent 86e9bdded2
commit a8ef41dc35
3 changed files with 8 additions and 8 deletions
+5 -5
View File
@@ -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