Added an index on automated_email_recipients.mailgun_message_id#29539
Conversation
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds MySQL prefix-index support to schema commands, including generated index names and configurable column-prefix lengths. Configures a 31-character index for 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 3m 4s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 12s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 2m 58s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 2m 43s | View ↗ |
nx run-many -t test:unit -p ghost |
✅ Succeeded | 30s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 4s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 21s | View ↗ |
nx run-many -t lint -p ghost,ghost-monorepo |
✅ Succeeded | 18s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-22 20:08:38 UTC
dd4fae3 to
ca1e40e
Compare
closes https://linear.app/ghost/issue/NY-1476 What ---- Adds support for [index prefixes in isMySQL][0]. This change should have no user impact. Why --- MySQL can't index long `VARCHAR`s in full. You can solve this by hashing the value or by using an [index prefix][0], which effectively only indexes the first *N* characters. We'll want to do the latter in an upcoming patch, so let's add support for it to our migration system (`addIndex`) and our table creation system (`createTable`). Notably, we have to do a little work to ensure that we generate the index name the same way Knex does, that way `dropIndex` will work. (Knex, unfortunately, doesn't expose this functionality directly, so we add a test to ensure they're the same.) [0]: https://dev.mysql.com/doc/refman/8.4/en/column-indexes.html#column-indexes-prefix
closes https://linear.app/ghost/issue/NY-1464 This index should improve performance.
ca1e40e to
50274f6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #29539 +/- ##
==========================================
+ Coverage 74.53% 74.80% +0.27%
==========================================
Files 1609 1611 +2
Lines 141475 141659 +184
Branches 17261 17320 +59
==========================================
+ Hits 105443 105975 +532
+ Misses 34998 34612 -386
- Partials 1034 1072 +38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

closes https://linear.app/ghost/issue/NY-1464
closes https://linear.app/ghost/issue/NY-1476
What
Adds an index to improve performance.
Along the way, had to add support for index prefixes in isMySQL.
Why
MySQL can't index long
VARCHARs in full. You can solve this by hashing the value or by using an index prefix, which effectively only indexes the first N characters.We chose the latter: an index prefix. We don't need uniqueness so it's okay if there's a little overlap.
The bulk of this PR adds support for those index prefixes, with the actual migration as a little sprinkle on top.
Test plan
Added several automated tests.
Also manually ran this SQL and checked the output, on both a fresh database and a migrated one:
I did not test this with real data on staging because (1) I didn't want to (2) I think it's relatively low-risk. Happy to do that if you think I should.