🚨 Critical Hotfix: Cloudflare D1 Schema Migration
Release Date: 2026-01-17
Priority: HIGH (fixes container reboot loop)
Overview
This hotfix resolves a critical bug affecting Cloudflare users upgrading from v8.69.0 to v8.72.0+ that caused container reboot loops due to missing database columns.
Fixed
CRITICAL: Automatic Schema Migration for Cloudflare D1 Backend
Issue: Container reboot loop for Cloudflare users upgrading from v8.69.0 → v8.72.0+
Root Cause: v8.72.0 added tags and deleted_at columns, but Cloudflare backend had no migration logic.
Impact:
- Users upgrading from v8.69.0 → v8.72.0+ experienced container reboot loop
400 Bad Requesterrors from D1 when trying to use missing columns- Service unable to start until manual database intervention
Solution:
- Added
_migrate_d1_schema()method with automatic column detection and migration - Implemented
_add_column_with_retry()with retry logic for D1 metadata sync issues - Added clear error messages with manual SQL workaround if automated migration fails
- 9 integration tests covering all migration scenarios
Migration Process (Automatic on first startup):
- Check existing schema using
PRAGMA table_info(memories) - Add missing columns:
tags TEXT,deleted_at REAL DEFAULT NULL - Create index:
idx_memories_deleted_at - Verify columns are usable (handles D1 metadata sync issues)
Migration Safety:
- Idempotent (safe to run multiple times)
- Zero data loss (only adds columns)
- Backward compatible (works with all versions v8.69.0+)
Manual Workaround (if automated migration fails):
ALTER TABLE memories ADD COLUMN tags TEXT;
ALTER TABLE memories ADD COLUMN deleted_at REAL DEFAULT NULL;
CREATE INDEX IF NOT EXISTS idx_memories_deleted_at ON memories(deleted_at);Upgrade Instructions
For Cloudflare Users:
- Upgrade to v9.0.3 immediately:
pip install --upgrade mcp-memory-service - Restart service (migration runs automatically on first startup)
- Verify migration: Check logs for "Schema migration completed successfully"
For Docker Users:
docker pull ghcr.io/doobidoo/mcp-memory-service:v9.0.3
# or
docker pull doobidoo/mcp-memory-service:v9.0.3Related Issues
Files Changed
src/mcp_memory_service/storage/cloudflare.py:290-495- Added migration methodstests/unit/test_cloudflare_migration.py- 387 lines of integration tests
Full Changelog
See CHANGELOG.md for complete details.
Recommendation: All Cloudflare users on v8.72.0+ should upgrade to v9.0.3 immediately to ensure proper database schema compatibility.