sqlite3 orders.db "VACUUM;"
EDIT:
All databases should be vacuumed once per month or so… more often with more traffic.
If you are running Docker on GNU/Linux, this can be automated quite easily using cron
and some simple BASH scripts. Here’s a simple script that should check vacuum all the databases.
dbs=$(ls ./storage/*.db)
c="VACUUM;"
for i in $dbs
do
sqlite3 $i "$c"
done