Created
February 9, 2026 21:15
-
-
Save chamlis/137865c91cfa1877bc492ef30b393fad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -eu | |
| if [ "$#" -ne 2 ]; then | |
| echo "Usage: $0 input.db output.sql" >&2 | |
| exit 1 | |
| fi | |
| if ! [ -f "$1" ]; then | |
| echo "Input must be a file" >&2 | |
| exit 1 | |
| fi | |
| WORKDIR=$(mktemp -d) | |
| trap 'rm -rf "$WORKDIR"' EXIT | |
| TMP_DB="$WORKDIR/tmp.db" | |
| sqlite3 -readonly "$1" ".backup '$TMP_DB'" | |
| sqlite3 -readonly "$TMP_DB" ".dump --preserve-rowids" > "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment