Wiki.js: only back up db.sqlite on SQLite installs (#17993)

Installs since February 2025 use PostgreSQL and have no db.sqlite, so the update stopped at the backup (#17971). mkdir -p lets a rerun get past the backup folder a failed run left behind.
This commit is contained in:
CanbiZ (MickLesk)
2026-10-18 21:32:11 +02:00
committed by GitHub
parent 2bfc7882d3
commit be863ab405
+9 -12
View File
@@ -33,22 +33,18 @@ function update_script() {
NODE_VERSION="26" NODE_MODULE="yarn,node-gyp" setup_nodejs
if check_for_gh_release "wikijs" "requarks/wiki-v2"; then
#msg_info "Verifying whether ${APP}' new release is v3.x+ and current install uses SQLite."
#SQLITE_INSTALL=$([ -f /opt/wikijs/db.sqlite ] && echo "true" || echo "false")
#if [[ "${SQLITE_INSTALL}" == "true" && "${CHECK_UPDATE_RELEASE}" =~ ^3.* ]]; then
# echo "SQLite is not supported in v3.x+, currently there is no update path availble."
# exit
#fi
#msg_ok "There is an update path available for ${APP}"
# Installs before February 2025 use SQLite, newer ones PostgreSQL
SQLITE_INSTALL=$([[ -f /opt/wikijs/db.sqlite ]] && echo "true" || echo "false")
msg_info "Stopping Service"
systemctl stop wikijs
msg_ok "Stopped Service"
msg_info "Backing up Data"
mkdir /opt/wikijs-backup
#$SQLITE_INSTALL &&
cp /opt/wikijs/db.sqlite /opt/wikijs-backup
mkdir -p /opt/wikijs-backup
if [[ "$SQLITE_INSTALL" == "true" ]]; then
cp /opt/wikijs/db.sqlite /opt/wikijs-backup
fi
cp -R /opt/wikijs/{config.yml,/data} /opt/wikijs-backup
msg_ok "Backed up Data"
@@ -56,8 +52,9 @@ function update_script() {
msg_info "Restoring Data"
cp -R /opt/wikijs-backup/* /opt/wikijs
#$SQLITE_INSTALL &&
$STD npm rebuild sqlite3
if [[ "$SQLITE_INSTALL" == "true" ]]; then
$STD npm rebuild sqlite3
fi
rm -rf /opt/wikijs-backup
msg_ok "Restored Data"