getConnection(); // Create timers table $sql = "CREATE TABLE IF NOT EXISTS timers ( id INT AUTO_INCREMENT PRIMARY KEY, task_id INT NOT NULL, user_id INT NOT NULL, start_time TIMESTAMP NULL DEFAULT NULL, end_time TIMESTAMP NULL DEFAULT NULL, duration VARCHAR(8) NULL DEFAULT NULL, description TEXT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE, FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, INDEX idx_timers_task_id (task_id), INDEX idx_timers_user_id (user_id), INDEX idx_timers_created_at (created_at) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"; $db->exec($sql); echo "Timers table created successfully\n"; } catch(PDOException $e) { echo "Error creating timers table: " . $e->getMessage() . "\n"; } ?>