[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:
parent
86e9bdded2
commit
a8ef41dc35
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS api_keys (
|
CREATE TABLE IF NOT EXISTS api_keys (
|
||||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
organization_id INT UNSIGNED NOT NULL,
|
organization_id INT NOT NULL,
|
||||||
created_by INT UNSIGNED NOT NULL,
|
created_by INT NOT NULL,
|
||||||
name VARCHAR(100) NOT NULL, -- Nome descrittivo es. "SIEM Integration"
|
name VARCHAR(100) NOT NULL, -- Nome descrittivo es. "SIEM Integration"
|
||||||
key_prefix VARCHAR(12) NOT NULL, -- Prefisso visibile es. "nis2_abc123"
|
key_prefix VARCHAR(12) NOT NULL, -- Prefisso visibile es. "nis2_abc123"
|
||||||
key_hash VARCHAR(64) NOT NULL, -- SHA-256 della chiave completa
|
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 (
|
CREATE TABLE IF NOT EXISTS webhook_subscriptions (
|
||||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
organization_id INT UNSIGNED NOT NULL,
|
organization_id INT NOT NULL,
|
||||||
created_by INT UNSIGNED NOT NULL,
|
created_by INT NOT NULL,
|
||||||
name VARCHAR(100) NOT NULL, -- Es. "231 Agile Notify"
|
name VARCHAR(100) NOT NULL, -- Es. "231 Agile Notify"
|
||||||
url VARCHAR(512) NOT NULL, -- URL destinazione POST
|
url VARCHAR(512) NOT NULL, -- URL destinazione POST
|
||||||
secret VARCHAR(64) NOT NULL, -- Usato per HMAC-SHA256 firma
|
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 (
|
CREATE TABLE IF NOT EXISTS webhook_deliveries (
|
||||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
subscription_id INT UNSIGNED NOT NULL,
|
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_type VARCHAR(60) NOT NULL, -- Es. "incident.created"
|
||||||
event_id VARCHAR(36) NOT NULL, -- UUID dell'evento
|
event_id VARCHAR(36) NOT NULL, -- UUID dell'evento
|
||||||
payload MEDIUMTEXT NOT NULL, -- JSON payload inviato
|
payload MEDIUMTEXT NOT NULL, -- JSON payload inviato
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS whistleblowing_reports (
|
CREATE TABLE IF NOT EXISTS whistleblowing_reports (
|
||||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
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
|
report_code VARCHAR(20) NOT NULL UNIQUE, -- Es. WB-2026-001
|
||||||
|
|
||||||
-- Mittente (opzionale — anonimato garantito)
|
-- Mittente (opzionale — anonimato garantito)
|
||||||
|
|||||||
@ -32,8 +32,8 @@ CREATE TABLE IF NOT EXISTS normative_updates (
|
|||||||
CREATE TABLE IF NOT EXISTS normative_ack (
|
CREATE TABLE IF NOT EXISTS normative_ack (
|
||||||
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
||||||
normative_update_id INT UNSIGNED NOT NULL,
|
normative_update_id INT UNSIGNED NOT NULL,
|
||||||
organization_id INT UNSIGNED NOT NULL,
|
organization_id INT NOT NULL,
|
||||||
acknowledged_by INT UNSIGNED NOT NULL,
|
acknowledged_by INT NOT NULL,
|
||||||
acknowledged_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
acknowledged_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
notes TEXT NULL, -- Note opzionali dell'org sull'impatto
|
notes TEXT NULL, -- Note opzionali dell'org sull'impatto
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user