﻿MMEX History Clean - Version 1.1
================================
Windows 10/11 x64, Windows PowerShell 5.1. No installation or administrator rights needed.

START
1. Close Money Manager Ex (MMEX).
2. Extract the entire ZIP into a folder.
3. Double-click START_MMEX_History_Clean.cmd.
4. The standard installed file is selected automatically if it exists:
   %APPDATA%\MoneyManagerEx\mmexini.db3
   For portable MMEX, click Browse and select its own mmexini.db3.
5. Check the number of Usage_V1 entries displayed.
6. Click Delete history and compact, then confirm Yes.

Languages: English, German, French, Italian, Spanish and Portuguese.
The Windows display language is selected automatically; other languages fall back to English.
You can switch language in the window. To force English at startup:
START_MMEX_History_Clean.cmd -Language en

WHAT IT DOES
- Reads SELECT COUNT(*) FROM Usage_V1 without writing to the database.
- Checks database integrity and rejects unexpected triggers on Usage_V1.
- Creates an SQLite backup next to the selected file, including any WAL data.
- Deletes all rows from Usage_V1 inside a transaction; the table itself remains.
- Runs VACUUM to reclaim free pages and reduce the database file size.
- Verifies that Usage_V1 is empty and the database passes quick_check.
- Displays deleted entries, size before/after and the backup location.
Other settings are not intentionally changed. No bookkeeping database is selected.
If there are zero entries, you can still confirm to compact the settings database.
Compaction is SQLite VACUUM, not ZIP compression; the result remains a normal .db3.
The displayed size is the main database file, not its temporary journal/WAL files.
The size may remain unchanged if little space can be reclaimed.
MMEX can create new history entries when you use it again.

BACKUP / RESTORE
Backup name: mmexini.db3.HistoryClean-YYYYMMDD-HHMMSS-xxxxxxxx.bak
Backups remain in the same folder and are not automatically deleted.
The backup still contains the original access history.
To restore: close MMEX and the tool. Keep the current mmexini.db3 as another copy,
and copy the backup to mmexini.db3. If journal/WAL files remain after a crash,
do not overwrite only the main database file; seek help before restoring.
If a final step fails after deletion, the message clearly reports that deletion
was already committed and shows the backup path. Nothing is restored automatically.

FILES
START_MMEX_History_Clean.cmd  - double-click launcher
MMEX_History_Clean.ps1        - graphical interface
MMEX_History_Clean_Core.ps1   - SQLite operations
Languages.json              - translations
sqlite3.exe                 - official SQLite Windows x64 command-line tool
README_EN.txt / Anleitung_DE.txt / Quick_Start_Multilingual.txt
SQLITE_SOURCE.txt            - source and checksums

Keep all files together. Do not run directly from inside the ZIP.
Standard permissions to write to the selected file/folder are required.
Use a local file, not a database concurrently used by another computer.
No downloads, network calls, scheduled tasks or telemetry are made by this tool.

Validation: PowerShell syntax checks; count, backup, deletion, settings retention,
VACUUM and database checks against synthetic SQLite fixtures in rollback-journal
and WAL modes, including paths with spaces, accented letters and apostrophes;
empty/missing/locked databases and unexpected triggers.
The Windows graphical interface requires testing on Windows.

Version 1.1: Fix Windows backslash escaping in the SQLite backup command.
Backup paths are preserved, and the resulting backup location is checked.
