Skip to content

Fix dropAllData FK constraint violation on beacon deletion#2249

Merged
hulto merged 2 commits intomainfrom
copilot/bug-fix-drop-all-data-error
Apr 16, 2026
Merged

Fix dropAllData FK constraint violation on beacon deletion#2249
hulto merged 2 commits intomainfrom
copilot/bug-fix-drop-all-data-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

dropAllData was always failing with FOREIGN KEY constraint failed because the deletion order omitted several entity types that hold FK references to Beacon, Host, and Quest.

Missing deletions

Entity FK references Must precede
Notification notification_event Event
Event beacon_events, host_events, quest_events Beacon, Host, Quest
BeaconHistory beacon_history_beacon Beacon
ShellPivot shell_id, portal_id, credential_id Shell, Portal, HostCredential
Adventure referenced by quest.adventure_id — (add after Quest)
ScheduledTask referenced by quest.scheduled_task_id — (add after Quest)

Changes

  • mutation.resolvers.go — inserts the six missing Delete() calls in topologically correct order within DropAllData
  • testdata/mutations/dropAllData/WithEvents.yml — adds a regression test that seeds events, notifications, and beacon_histories before calling dropAllData, directly covering the reported failure path

Copilot AI changed the title [WIP] Fix data not cleared after running dropAllData in graphql Fix dropAllData FK constraint violation on beacon deletion Apr 16, 2026
Copilot AI requested a review from hulto April 16, 2026 18:38
Copy link
Copy Markdown
Collaborator

@hulto hulto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot run go generate ./tavern/... and commit the generated files

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@copilot run go generate ./tavern/... and commit the generated files

Ran go generate ./tavern/... — the working tree remained clean. Our changes were limited to the hand-written mutation.resolvers.go and a new YAML test fixture, neither of which affects generated files, so there's nothing new to commit.

Copilot AI requested a review from hulto April 16, 2026 21:22
@hulto hulto marked this pull request as ready for review April 16, 2026 21:27
@hulto hulto merged commit c9980dc into main Apr 16, 2026
10 checks passed
@hulto hulto deleted the copilot/bug-fix-drop-all-data-error branch April 16, 2026 22:08
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.

[bug] Data is not cleared after running dropAllData in graphql

2 participants