Skip to content

Add db:vacuum command to reclaim SQLite space#1138

Merged
saeedvaziry merged 4 commits into
4.xfrom
vacuum-db
May 29, 2026
Merged

Add db:vacuum command to reclaim SQLite space#1138
saeedvaziry merged 4 commits into
4.xfrom
vacuum-db

Conversation

@saeedvaziry
Copy link
Copy Markdown
Member

Adds a db:vacuum artisan command that compacts the SQLite panel database, reclaiming free pages left behind after metrics pruning (a 248MB DB shrank to ~7MB in testing). It is driver-guarded (skips on non-SQLite) and performs a free-disk-space pre-check before running. Scheduled daily, right after metrics:delete-older-metrics.

Adds a driver-guarded db:vacuum command that compacts the SQLite database, with a free-disk-space pre-check, and schedules it daily after metrics pruning.
@RichardAnderson RichardAnderson requested a review from Copilot May 28, 2026 19:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread app/Console/Commands/VacuumDatabaseCommand.php Outdated
Comment on lines +14 to +18
public function handle(): int
{
$connection = DB::connection();

if ($connection->getDriverName() !== 'sqlite') {
Comment on lines +33 to +36
$available = disk_free_space(dirname($database));

if ($available !== false && $available < $required) {
$this->warn(sprintf(
saeedvaziry and others added 2 commits May 28, 2026 23:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@saeedvaziry saeedvaziry merged commit 6a0bc5b into 4.x May 29, 2026
3 checks passed
@saeedvaziry saeedvaziry deleted the vacuum-db branch May 29, 2026 13:57
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.

3 participants