CREATE TABLE IF NOT EXISTS dokumenti (
    id INT AUTO_INCREMENT PRIMARY KEY,
    uploaded_by INT NOT NULL,
    voznja_id INT NOT NULL,
    tip VARCHAR(50) DEFAULT 'zavrsenje_voznje',
    naziv_fajla VARCHAR(255) NOT NULL,
    putanja VARCHAR(500) NOT NULL,
    velicina_fajla INT DEFAULT 0,
    mime_type VARCHAR(100),
    vreme TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (uploaded_by) REFERENCES users(id) ON DELETE CASCADE,
    FOREIGN KEY (voznja_id) REFERENCES voznje(id) ON DELETE CASCADE,
    INDEX idx_voznja_id (voznja_id),
    INDEX idx_uploaded_by (uploaded_by),
    INDEX idx_tip (tip)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

