Skip to content

feat: add composite index on messages(channel_id, created_at)#132

Merged
mahata merged 2 commits intofeat/channelsfrom
copilot/sub-pr-130
Mar 26, 2026
Merged

feat: add composite index on messages(channel_id, created_at)#132
mahata merged 2 commits intofeat/channelsfrom
copilot/sub-pr-130

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

Without an index, queries filtering messages by channel with ordering (WHERE channel_id = ? ORDER BY created_at DESC LIMIT 100) result in sequential scans as the table grows.

Changes

  • hono/db/schema.ts: Added a btree composite index messages_channel_id_created_at_idx on (channel_id, created_at) to the messages table
  • hono/db/migrations/0003_spotty_christian_walker.sql: Generated migration applying the index
CREATE INDEX "messages_channel_id_created_at_idx" ON "messages" USING btree ("channel_id","created_at");

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] [WIP] Address feedback on Slack-like channels and sidebar UI implementation feat: add composite index on messages(channel_id, created_at) Mar 26, 2026
Copilot AI requested a review from mahata March 26, 2026 07:16
@mahata mahata marked this pull request as ready for review March 26, 2026 07:23
@mahata mahata merged commit a792d09 into feat/channels Mar 26, 2026
1 check passed
@mahata mahata deleted the copilot/sub-pr-130 branch March 26, 2026 07:23
mahata added a commit that referenced this pull request Mar 26, 2026
…aging (#130)

* feat: add Slack-like channels with sidebar UI and channel-scoped messaging

Add a Channel feature where each message belongs to a single channel and
channels can have multiple members. All users are auto-joined to #general.

- Add channels and channel_members tables with migration (seeds #general,
  backfills existing messages)
- Add channel CRUD API routes (list, create, join, leave) with 14 tests
- Update messages API to require channelId query parameter
- Switch WebSocket protocol from plain text to JSON with channel-scoped
  broadcast (only channel members receive messages)
- Add dark-themed Slack-like UI with channel sidebar, create channel modal,
  join/leave functionality
- Auto-join users to #general on page visit
- Update all existing tests for new HTML structure and API changes

* Update hono/routes/messages.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update hono/static/ChatPage.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: add composite index on messages(channel_id, created_at) (#132)

* Initial plan

* feat: add composite index on (channel_id, created_at) to messages table

Agent-Logs-Url: https://github.com/mahata/mlack/sessions/d188e657-de69-47e9-9277-0c7227faaffd

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>

* [WIP] Fix the failing GitHub Actions workflow e2e (#134)

* Initial plan

* fix: add h1 Hello, world! heading to ChatPage for e2e test

Agent-Logs-Url: https://github.com/mahata/mlack/sessions/00133b70-6800-4b81-9ad8-fb4b19a6e07c

Co-authored-by: mahata <23497+mahata@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mahata <23497+mahata@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants