CREATE TABLE odp_connections (
id INTEGER PRIMARY KEY AUTOINCREMENT,
from_odp_id INTEGER NOT NULL,
to_odp_id INTEGER NOT NULL,
connection_type VARCHAR(50) DEFAULT 'fiber' CHECK (connection_type IN ('fiber', 'copper', 'wireless', 'microwave')),
cable_length DECIMAL(8,2),
cable_capacity VARCHAR(20) DEFAULT '1G' CHECK (cable_capacity IN ('100M', '1G', '10G', '100G')),
status VARCHAR(20) DEFAULT 'active' CHECK (status IN ('active', 'maintenance', 'inactive', 'damaged')),
installation_date DATE,
notes TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (from_odp_id) REFERENCES odps(id) ON DELETE CASCADE,
FOREIGN KEY (to_odp_id) REFERENCES odps(id) ON DELETE CASCADE,
UNIQUE(from_odp_id, to_odp_id)
)