fix: add missing database indexes #51

Merged
Snider merged 1 commit from fix/add-missing-indexes into main 2026-02-23 06:38:16 +00:00
Member

Summary

  • Verified agent_sessions.session_id: the unique() constraint creates agent_sessions_session_id_unique — sufficient for string lookups, no redundant index needed
  • Dropped redundant agent_plans_slug_index: the unique constraint already provides an index covering all slug lookups
  • Added compound (workspace_id, slug) index on agent_plans for the common routing pattern WHERE workspace_id = ? AND slug = ?
  • Verified agent_workspace_states.key: already indexed in migration 000003, no change needed

Closes #21

Test plan

  • Run php artisan migrate — migration applies cleanly
  • Verify agent_plans_slug_index is dropped and agent_plans_workspace_slug_index is created
  • Verify agent_sessions_session_id_unique still exists (unchanged)
  • Run php artisan migrate:rollbackdown() restores original state
## Summary - Verified `agent_sessions.session_id`: the `unique()` constraint creates `agent_sessions_session_id_unique` — sufficient for string lookups, no redundant index needed - Dropped redundant `agent_plans_slug_index`: the unique constraint already provides an index covering all slug lookups - Added compound `(workspace_id, slug)` index on `agent_plans` for the common routing pattern `WHERE workspace_id = ? AND slug = ?` - Verified `agent_workspace_states.key`: already indexed in migration 000003, no change needed Closes #21 ## Test plan - [ ] Run `php artisan migrate` — migration applies cleanly - [ ] Verify `agent_plans_slug_index` is dropped and `agent_plans_workspace_slug_index` is created - [ ] Verify `agent_sessions_session_id_unique` still exists (unchanged) - [ ] Run `php artisan migrate:rollback` — `down()` restores original state
Clotho added 1 commit 2026-02-23 06:33:06 +00:00
fix: add missing database indexes (closes #21)
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 1m36s
CI / PHP 8.4 (pull_request) Failing after 1m41s
764728759d
- 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>
Snider merged commit db0cc0abad into main 2026-02-23 06:38:16 +00:00
Snider deleted branch fix/add-missing-indexes 2026-02-23 06:38:16 +00:00
Sign in to join this conversation.
No description provided.