Files
claudetools/scripts/migrate-data-to-rmm.sh
Mike Swanson 25f3759ecc [Config] Add coding guidelines and code-fixer agent
Major additions:
- Add CODING_GUIDELINES.md with "NO EMOJIS" rule
- Create code-fixer agent for automated violation fixes
- Add offline mode v2 hooks with local caching/queue
- Add periodic context save with invisible Task Scheduler setup
- Add agent coordination rules and database connection docs

Infrastructure:
- Update hooks: task-complete-v2, user-prompt-submit-v2
- Add periodic_save_check.py for auto-save every 5min
- Add PowerShell scripts: setup_periodic_save.ps1, update_to_invisible.ps1
- Add sync-contexts script for queue synchronization

Documentation:
- OFFLINE_MODE.md, PERIODIC_SAVE_INVISIBLE_SETUP.md
- Migration procedures and verification docs
- Fix flashing window guide

Updates:
- Update agent configs (backup, code-review, coding, database, gitea, testing)
- Update claude.md with coding guidelines reference
- Update .gitignore for new cache/queue directories

Status: Pre-automated-fixer baseline commit

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 12:51:43 -07:00

108 lines
2.9 KiB
Bash

#!/bin/bash
#
# Migrate Data from Jupiter (172.16.3.20) to RMM (172.16.3.30)
# Migrates conversation contexts and any other data
#
set -e
echo "=========================================="
echo "ClaudeTools Data Migration"
echo "=========================================="
echo ""
echo "Source: Jupiter (172.16.3.20:3306) - Docker MariaDB"
echo "Target: RMM (172.16.3.30:3306) - Native MariaDB"
echo ""
# Database credentials
DB_USER="claudetools"
DB_PASS="CT_e8fcd5a3952030a79ed6debae6c954ed"
DB_NAME="claudetools"
SOURCE_HOST="172.16.3.20"
TARGET_HOST="172.16.3.30"
# Step 1: Export data from Jupiter
echo "[1/4] Exporting data from Jupiter (172.16.3.20)..."
echo ""
# Use PuTTY's plink instead of SSH
plink -batch guru@${SOURCE_HOST} "docker exec mariadb mysqldump \
-u ${DB_USER} \
-p${DB_PASS} \
--no-create-info \
--skip-add-drop-table \
--insert-ignore \
${DB_NAME} > /tmp/claudetools_data.sql && \
cat /tmp/claudetools_data.sql" > D:/ClaudeTools/temp_data_export.sql
EXPORT_SIZE=$(wc -l < D:/ClaudeTools/temp_data_export.sql)
echo "Exported ${EXPORT_SIZE} lines"
echo ""
# Step 2: Check what tables have data
echo "[2/4] Analyzing exported data..."
echo ""
grep "^INSERT INTO" D:/ClaudeTools/temp_data_export.sql | \
sed 's/INSERT INTO `\([^`]*\)`.*/\1/' | \
sort | uniq -c | \
awk '{printf " %-30s %s rows\n", $2, $1}'
echo ""
# Step 3: Copy to RMM server
echo "[3/4] Transferring to RMM server..."
echo ""
# Use PuTTY's pscp to copy file
pscp -batch D:/ClaudeTools/temp_data_export.sql guru@${TARGET_HOST}:/tmp/
echo "File transferred"
echo ""
# Step 4: Import into RMM database
echo "[4/4] Importing into RMM database..."
echo ""
plink -batch guru@${TARGET_HOST} "mysql \
-u ${DB_USER} \
-p${DB_PASS} \
-D ${DB_NAME} < /tmp/claudetools_data.sql && \
echo 'Import successful'"
echo ""
# Step 5: Verify
echo "=========================================="
echo "Verification"
echo "=========================================="
echo ""
plink -batch guru@${TARGET_HOST} "mysql \
-u ${DB_USER} \
-p${DB_PASS} \
-D ${DB_NAME} \
-e \"SELECT 'conversation_contexts' as table_name, COUNT(*) as records FROM conversation_contexts \
UNION ALL SELECT 'credentials', COUNT(*) FROM credentials \
UNION ALL SELECT 'clients', COUNT(*) FROM clients \
UNION ALL SELECT 'machines', COUNT(*) FROM machines \
UNION ALL SELECT 'sessions', COUNT(*) FROM sessions;\" 2>/dev/null"
echo ""
echo "=========================================="
echo "Data Migration Complete!"
echo "=========================================="
echo ""
# Cleanup
rm -f D:/ClaudeTools/temp_data_export.sql
plink -batch guru@${TARGET_HOST} "rm -f /tmp/claudetools_data.sql" 2>/dev/null || true
echo "Temporary files cleaned up"
echo ""
echo "Next steps:"
echo " 1. Verify data in database"
echo " 2. Test context recall via API"
echo " 3. Update any remaining references to 172.16.3.20"
echo ""