fix: add missing database indexes #51
No reviewers
Labels
No labels
P1
P2
P3
PHP
agent-ready
bug
clotho
discovery
docs
refactor
review
security
testing
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: core/php-agentic#51
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/add-missing-indexes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
agent_sessions.session_id: theunique()constraint createsagent_sessions_session_id_unique— sufficient for string lookups, no redundant index neededagent_plans_slug_index: the unique constraint already provides an index covering all slug lookups(workspace_id, slug)index onagent_plansfor the common routing patternWHERE workspace_id = ? AND slug = ?agent_workspace_states.key: already indexed in migration 000003, no change neededCloses #21
Test plan
php artisan migrate— migration applies cleanlyagent_plans_slug_indexis dropped andagent_plans_workspace_slug_indexis createdagent_sessions_session_id_uniquestill exists (unchanged)php artisan migrate:rollback—down()restores original state- Verify agent_sessions.session_id: unique() constraint creates an implicit unique index (agent_sessions_session_id_unique) which is sufficient for string lookups; no additional index required - Drop redundant agent_plans_slug_index: the unique() constraint on slug already provides agent_plans_slug_unique covering all lookups - Add compound (workspace_id, slug) index on agent_plans for the common routing pattern WHERE workspace_id = ? AND slug = ? - Verify agent_workspace_states.key: already indexed via ->index('key') in migration 000003; no additional index required - Mark DB-002 as resolved in TODO.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>