Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Enhance Telescope Clear Method #1506

Closed
wants to merge 1 commit into from
Closed

Conversation

a1383n
Copy link
Contributor

@a1383n a1383n commented Aug 19, 2024

This PR refines the clear method in the Laravel Telescope DatabaseEntriesRepository for a more efficient and reliable table-clearing process.

Key Improvements:

  • Safe Truncate: The method now attempts to truncate the telescope_entries and telescope_monitoring tables using Schema::withoutForeignKeyConstraints, effectively managing foreign key constraints.
  • Fallback to Chunked Deletion: If truncation fails due to a PDOException, the method automatically falls back to chunked deletion, ensuring that the clearing process completes smoothly.
  • Performance Boost: Truncation is significantly faster than chunked deletion, optimizing the clearing process while preserving fallback options for reliability.

References:

This solution is stable, backward-compatible, and ready for review.

@driesvints
Copy link
Member

Tests are failing here. Please resend this with passing tests, thanks.

@driesvints driesvints closed this Aug 19, 2024
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.

2 participants