Skip to content

Fix recurring events blocked by unique source_ref - #3669

Merged
bernardhanna merged 1 commit into
masterfrom
fix/recurring-events-source-ref
Sep 28, 2026
Merged

bernardhanna merged 1 commit into
masterfrom
fix/recurring-events-source-ref

Conversation

@bernardhanna

Copy link
Copy Markdown
Collaborator

Problem

Live logs ~15 Recurring generation error lines every night:

Duplicate entry 'parent:1286798' for key 'events_source_ref_unique'

events:generate-recurring stores every child as source_ref = parent:{id}. That column has a unique index (used by partner imports). After the first child is written, every later occurrence collides.

95 approved recurring series are still eligible; 678 already have a single legacy child and cannot advance.

Fix

  • New children use parent:{id}:{Y-m-d}.
  • On each run, rewrite any bare parent:{id} row to the dated form so the unique index frees up.
  • Existence check covers dated, legacy, and same-calendar-day rows.

Tests

tests/Feature/GenerateRecurringEventsTest.php — three cases, all pass:

  • first child gets a dated ref
  • legacy bare ref is rekeyed and a further occurrence is created
  • a second run does not duplicate

Deploy note

Safe to ship before October: it stops nightly error noise and unblocks series that have been stuck since their first child. Dry-run first on live if preferred:

php artisan events:generate-recurring --dry-run

Made with Cursor

events:generate-recurring wrote every child as source_ref=parent:{id}.
That column is unique, so after the first occurrence every later night
failed with a duplicate-key error (~15 parents/day on live).

Use parent:{id}:{Y-m-d} instead, and rewrite any legacy bare parent:{id}
row so further occurrences can be created.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bernardhanna
bernardhanna merged commit bb50f3e into master Sep 28, 2026
1 check failed
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.

1 participant