tasks_schema.sql 766 B

1234567891011121314151617181920
  1. -- Tasks database schema
  2. -- For managing project tasks and subtasks
  3. CREATE TABLE IF NOT EXISTS tasks (
  4. id INT AUTO_INCREMENT PRIMARY KEY,
  5. title VARCHAR(255) NOT NULL,
  6. description TEXT NULL,
  7. status ENUM('pending', 'in_progress', 'completed', 'on_hold', 'cancelled') DEFAULT 'pending',
  8. priority ENUM('low', 'medium', 'high') DEFAULT 'medium',
  9. project_id INT NULL,
  10. due_date DATE NULL,
  11. created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  12. updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  13. INDEX idx_project_id (project_id),
  14. INDEX idx_status (status),
  15. INDEX idx_priority (priority),
  16. INDEX idx_created_at (created_at),
  17. FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
  18. );