Skip to content

feat: add method to clear free database pages - #2477

Open
krille-chan wants to merge 1 commit into
mainfrom
krille/add-method-to-clear-database-pages
Open

feat: add method to clear free database pages#2477
krille-chan wants to merge 1 commit into
mainfrom
krille/add-method-to-clear-database-pages

Conversation

@krille-chan

Copy link
Copy Markdown
Contributor

After a clearCache() the database file actually does not shrink in size but has empty pages. Without the auto vacuum pragma it can never really shrink. This adds an optional method the sdk consumer can call to fix it.

After a clearCache() the database file
actually does not shrink in size but
has empty pages. Without the auto
vacuum pragma it can never really
shrink. This adds an optional method
the sdk consumer can call to fix it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c09061c. Configure here.

return;
}

await database.execute('PRAGMA incremental_vacuum');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Vacuum pragmas use execute incorrectly

Medium Severity

ensureIncrementalAutoVacuum runs VACUUM and PRAGMA incremental_vacuum through execute. Incremental vacuum yields one SQLITE_ROW per reclaimed page, so plugin-backed execute/execSQL (including sqflite_sqlcipher) either throws or stops after a single page. After the first mode-switch, the documented every-start / post-clearCache() path then fails to shrink the file.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c09061c. Configure here.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.36%. Comparing base (474c4d9) to head (c09061c).

Files with missing lines Patch % Lines
lib/src/database/sqflite_encryption_helper/io.dart 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2477      +/-   ##
==========================================
- Coverage   60.38%   60.36%   -0.03%     
==========================================
  Files         162      162              
  Lines       20564    20572       +8     
==========================================
  Hits        12418    12418              
- Misses       8146     8154       +8     
Files with missing lines Coverage Δ
lib/src/database/sqflite_encryption_helper/io.dart 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 474c4d9...c09061c. Read the comment docs.

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