fix(events): Handle nullable label and milestone in resource events

GitLab returns null for the label/milestone fields on resource_label_events
and resource_milestone_events when the referenced label or milestone has
been deleted. This caused deserialization failures during sync.

- Add migration 012 to recreate both event tables with nullable
  label_name, milestone_title, and milestone_id columns (SQLite
  requires table recreation to alter NOT NULL constraints)
- Change GitLabLabelEvent.label and GitLabMilestoneEvent.milestone
  to Option<> in the Rust types
- Update upsert functions to pass through None values correctly
- Add tests for null label and null milestone deserialization

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-03 17:36:17 -05:00
parent deafa88af5
commit a92e176bb6
5 changed files with 134 additions and 14 deletions

View File

@@ -39,6 +39,10 @@ const MIGRATIONS: &[(&str, &str)] = &[
"011",
include_str!("../../migrations/011_resource_events.sql"),
),
(
"012",
include_str!("../../migrations/012_nullable_label_milestone.sql"),
),
];
/// Create a database connection with production-grade pragmas.