this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(infra): stop app before SQLite migration to prevent data loss

The app's WAL file was overriding the copied database. Now we:
- Stop the app container first
- Remove remote WAL/SHM files
- Copy the database
- Restart app before Letta import (which needs the container running)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

alice ffdc8c0c c2321005

+17 -2
+17 -2
infra/migrate-data.sh
··· 29 29 die() { log_error "$1"; exit 1; } 30 30 31 31 ####################################### 32 + # Stop app container 33 + ####################################### 34 + stop_app() { 35 + log_info "Stopping app container..." 36 + ssh "$SERVER_HOST" "cd /opt/assistant && docker compose -f docker-compose.yml -f docker-compose.prod.yml stop app" 37 + log_success "App stopped" 38 + } 39 + 40 + ####################################### 32 41 # Sync SQLite database 33 42 ####################################### 34 43 sync_sqlite() { ··· 45 54 if command -v sqlite3 &> /dev/null; then 46 55 sqlite3 "$db_file" "PRAGMA wal_checkpoint(TRUNCATE);" 2>/dev/null || true 47 56 fi 57 + 58 + # Remove remote WAL/SHM files to prevent stale data 59 + ssh "$SERVER_HOST" "rm -f /opt/assistant/data/assistant.db-wal /opt/assistant/data/assistant.db-shm" 48 60 49 61 # Copy to server 50 62 scp "$db_file" "$SERVER_HOST:/opt/assistant/data/assistant.db" ··· 207 219 die "Cannot connect to $SERVER_HOST" 208 220 fi 209 221 222 + # Stop app to safely copy SQLite database 223 + stop_app 210 224 sync_sqlite 211 225 226 + # Start app for Letta import (needs the app container running) 227 + restart_app 228 + 212 229 if export_letta_agent; then 213 230 import_letta_agent 214 231 fi 215 - 216 - restart_app 217 232 218 233 echo 219 234 log_success "Migration complete!"