diff --git a/ct/twenty.sh b/ct/twenty.sh index 9c42405b8..dd00bae61 100644 --- a/ct/twenty.sh +++ b/ct/twenty.sh @@ -36,10 +36,10 @@ function update_script() { systemctl stop twenty-worker twenty-server msg_ok "Stopped Services" - msg_info "Backing up Data" - cp /opt/twenty/.env /opt/twenty.env.bak - cp -r /opt/twenty/packages/twenty-server/.local-storage /opt/twenty_storage_backup 2>/dev/null || true - msg_ok "Backed up Data" + + create_backup /opt/twenty/.env \ + /opt/twenty/packages/twenty-server/.local-storage + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "twenty" "twentyhq/twenty" "tarball" @@ -67,10 +67,7 @@ function update_script() { $STD npx -y typeorm migration:run -d dist/database/typeorm/core/core.datasource msg_ok "Ran Database Migrations" - msg_info "Restoring Storage" - cp -r /opt/twenty_storage_backup/. /opt/twenty/packages/twenty-server/.local-storage/ 2>/dev/null || true - rm -rf /opt/twenty_storage_backup /opt/twenty.env.bak - msg_ok "Restored Storage" + restore_backup msg_info "Starting Services" systemctl start twenty-server twenty-worker