Skip to content

Instantly share code, notes, and snippets.

@lhns
Created October 24, 2020 23:24
Show Gist options
  • Save lhns/d6d8c05c1388532c719b3668ea4a666f to your computer and use it in GitHub Desktop.
Save lhns/d6d8c05c1388532c719b3668ea4a666f to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e -o pipefail
database="$1"
stat "$database"
[ -s "$database" ]
cp "$database" "${database}.bak"
sqlite3 "$database" -cmd ".mode insert" -cmd ".output dump_all.sql" -cmd ".dump" ".exit"
cat dump_all.sql | grep -v TRANSACTION | grep -v ROLLBACK | grep -v COMMIT >dump_all_notrans.sql
rm "$database"
sqlite3 "$database" ".read dump_all_notrans.sql"
stat "$database"
[ -s "$database" ]
echo done
@lhns
Copy link
Author

lhns commented Oct 24, 2020

docker run --rm -it --mount type=bind,source=x:\storagenode\storage,destination=/storage sstc/sqlite3 sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment