feat: add database migrations for D1 schema initialization#18
Conversation
- Create P2PSignal table for WebRTC signaling coordination - Create Message table for encrypted relay message storage - Add indexes for performant lookups on messageId and receiverPubKeyHash - Enables deployment of Serotine on fresh Cloudflare D1 instances
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
serotine | c13b653 | Commit Preview URL Branch Preview URL |
May 24 2026, 10:05 AM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c13b653de9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ); | ||
|
|
||
| -- Create index on messageId for fast lookups | ||
| CREATE INDEX IF NOT EXISTS idx_p2psignal_messageid ON P2PSignal(messageId); |
There was a problem hiding this comment.
Remove redundant index on unique messageId
messageId is declared UNIQUE, which already creates an index in SQLite/D1; adding idx_p2psignal_messageid duplicates that index and adds unnecessary write/storage overhead on every insert/update to P2PSignal. This is most noticeable under frequent signaling updates, where each write now maintains two indexes for the same key.
Useful? React with 👍 / 👎.
Summary
Why This Matters
The README documented the migration steps (
npx wrangler d1 migrations apply) but the actual migration files were not in the repository, blocking deployment of Serotine to fresh Cloudflare D1 instances.Changes
migrations/0001_init_schema.sqlwith:Validation
Generated by Claude Code