-- Tasks database schema -- For managing project tasks and subtasks CREATE TABLE IF NOT EXISTS tasks ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL, description TEXT NULL, status ENUM('pending', 'in_progress', 'completed', 'on_hold', 'cancelled') DEFAULT 'pending', priority ENUM('low', 'medium', 'high') DEFAULT 'medium', project_id INT NULL, due_date DATE NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, INDEX idx_project_id (project_id), INDEX idx_status (status), INDEX idx_priority (priority), INDEX idx_created_at (created_at), FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE );