fix(package): migrator: handle sqlite posible settings

This commit is contained in:
2025-12-23 18:30:26 +00:00
parent 686a794a69
commit cb96de6125

View File

@@ -80,7 +80,8 @@ db_exec() {
sqlite) sqlite)
local db_path local db_path
db_path=$(get_sqlite_path) db_path=$(get_sqlite_path)
printf '%s' "$sql" | sqlite3 "$db_path" # Use -batch for non-interactive execution
printf '%s' "$sql" | sqlite3 -batch "$db_path"
;; ;;
esac esac
} }
@@ -98,7 +99,8 @@ db_query() {
sqlite) sqlite)
local db_path local db_path
db_path=$(get_sqlite_path) db_path=$(get_sqlite_path)
sqlite3 "$db_path" "$sql" # Use -noheader -list for clean output (one value per line, no formatting)
sqlite3 -noheader -list "$db_path" "$sql" | awk NF
;; ;;
esac esac
} }
@@ -124,7 +126,7 @@ SQL
sqlite) sqlite)
local db_path local db_path
db_path=$(get_sqlite_path) db_path=$(get_sqlite_path)
sqlite3 "$db_path" <<SQL sqlite3 -batch "$db_path" <<SQL
BEGIN; BEGIN;
.read $file_path .read $file_path
COMMIT; COMMIT;
@@ -806,7 +808,7 @@ SQL
sqlite) sqlite)
local db_path local db_path
db_path=$(get_sqlite_path) db_path=$(get_sqlite_path)
if ! sqlite3 "$db_path" <<SQL if ! sqlite3 -batch "$db_path" <<SQL
BEGIN; BEGIN;
.read $mig_path .read $mig_path
INSERT INTO hectic_migration (name, hash) VALUES ('$escaped_name', '$mig_hash'); INSERT INTO hectic_migration (name, hash) VALUES ('$escaped_name', '$mig_hash');
@@ -862,7 +864,7 @@ SQL
sqlite) sqlite)
local db_path local db_path
db_path=$(get_sqlite_path) db_path=$(get_sqlite_path)
if ! sqlite3 "$db_path" <<SQL if ! sqlite3 -batch "$db_path" <<SQL
BEGIN; BEGIN;
.read $mig_path .read $mig_path
DELETE FROM hectic_migration WHERE name = '$escaped_name'; DELETE FROM hectic_migration WHERE name = '$escaped_name';