Added track_clicks and clicked_at columns to automated_email_recipients table#29529
Conversation
WalkthroughAdds Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 2m 17s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 1m 50s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 20s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 21s | View ↗ |
nx run-many -t lint -p ghost,ghost-monorepo |
✅ Succeeded | 20s | View ↗ |
nx run-many -t test:unit -p ghost |
✅ Succeeded | 30s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 2m 47s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 9s | 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 15:32:45 UTC
E2E Tests FailedTo view the Playwright test report locally, run: REPORT_DIR=$(mktemp -d) && gh run download 29926481869 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR" |
fe9bfc5 to
c7b7ced
Compare
| @@ -242,6 +242,8 @@ export function createDatabaseAutomationsRepository({ | |||
| automation_action_revision_id: options.automationActionRevisionId, | |||
| ...(options.mailgunMessageId ? {mailgun_message_id: options.mailgunMessageId} : {}), | |||
| track_opens: options.trackOpens, | |||
| // TODO(NY-1491) Snapshot the email_track_clicks setting when creating recipients. | |||
| track_clicks: false, | |||
There was a problem hiding this comment.
note: bookshelf passes track_clicks: null if we omit this, so we have to explicitly pass track_clicks: false or this migration will effectively break migrations.
| @@ -235,7 +235,8 @@ async function processRun({ | |||
| member_uuid: member.get('uuid'), | |||
| member_email: member.get('email'), | |||
| member_name: member.get('name'), | |||
| track_opens: false | |||
| track_opens: false, | |||
| track_clicks: false | |||
There was a problem hiding this comment.
note: same as above, but this will always remain false since we don't care about click tracking for welcome emails.
640fae5 to
fad725f
Compare
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@ghost/core/core/server/services/automations/database-automations-repository.ts`:
- Around line 245-246: Update recordEmailSent and its callers to thread the
automation’s email_track_clicks setting through options, then assign that value
to track_clicks when creating regular automation recipients instead of
hardcoding false. Preserve the welcome-email path’s explicitly disabled tracking
behavior if it is intentionally separate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 051dedd5-9384-4a05-a82a-96193ebd7c1e
📒 Files selected for processing (6)
ghost/core/core/server/data/migrations/versions/6.54/2026-07-22-10-41-08-add-click-tracking-to-automated-email-recipients.jsghost/core/core/server/data/schema/schema.jsghost/core/core/server/services/automations/database-automations-repository.tsghost/core/core/server/services/automations/welcome-email-automation-poll.jsghost/core/test/unit/server/data/schema/integrity.test.jsghost/core/test/unit/server/services/automations/automations-repository.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fad725f0e6
ℹ️ 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".
ref https://linear.app/ghost/issue/NY-1487/ Automation sends need to retain the click-tracking setting and first-click timestamp alongside the existing open analytics fields.
fad725f to
5f8108b
Compare
track_clicks and clicked_at columns to automated_email_recipients table
|
CI seems a bit backed up, but this should pass. |

closes https://linear.app/ghost/issue/NY-1487/
Summary