Adamic Support

Cloudflare D1 Database Manager

D1 Database Manager v2.0.0 transforms into an enterprise-ready solution with Drizzle ORM integration, scheduled R2 backups, a comprehensive metrics dashboard, and dramatic performance improvements. This major release brings 60-70% faster ER diagram loading, unified backup & restore hub, and comprehensive safety backups before destructive operations. No breaking changesβ€”all new features are additive.

⬆️ Upgrading from v1.x? If you want to use R2 backup features (scheduled backups, backup before delete/rename), add a Durable Object binding to your wrangler.toml. See the Upgrading section in README.md for step-by-step instructions. Docker users can skip thisβ€”Durable Objects only apply to Cloudflare Workers deployments.

🎯 Live Demo | 🐳 Docker Hub | πŸ“¦ GitHub

πŸ”§ Drizzle ORM Console - NEW in v2.0.0

Full Drizzle ORM integration for TypeScript developers. Introspect databases, manage migrations, and push schema changes directly from the browser with syntax highlighting and live SQL previews.

Introspect pulls schema from D1 database and generates Drizzle TypeScript schema, exportable as a downloadable schema.ts file. Migration Management shows applied Drizzle migrations and history, with schema comparison that parses Drizzle schema and generates SQL diff.

Push schema changes directly to database (with dry-run option) and validate schema against current database state. Automatic cache invalidation after pushβ€”table list refreshes without page reload.

New API Endpoints:

  • POST /api/drizzle/:dbId/introspect - Generate Drizzle schema
  • GET /api/drizzle/:dbId/migrations - Migration status
  • POST /api/drizzle/:dbId/push - Push schema changes
  • POST /api/drizzle/:dbId/check - Validate schema
  • GET /api/drizzle/:dbId/export - Export schema file

⏰ Scheduled R2 Backups - NEW in v2.0.0

Automated backup schedules via Cloudflare Workers cron triggers. Configure daily, weekly, or monthly backup schedules per database with precise timing control and full backup history tracking.

Choose specific day of week for weekly backups, day of month for monthly. Select backup hour (0-23 UTC) for precise scheduling. Enable/disable schedules without deleting configuration.

View last run status (success/failed), next run time, and backup history. All scheduled backups appear in the Backup & Restore hub for easy restore. Job history tracks all scheduled backups as "Scheduled Backup" operation type.

New API Endpoints:

  • GET /api/scheduled-backups - List scheduled backups
  • POST /api/scheduled-backups - Create/update scheduled backup
  • DELETE /api/scheduled-backups/:dbId - Delete scheduled backup

πŸ“Š Metrics Dashboard - NEW in v2.0.0

Comprehensive D1 analytics via GraphQL. Monitor query volume, rows read, latency, and storage across all databases with lightweight SVG-based charts and full accessibility support.

Summary cards display total queries (reads/writes), rows read, average P90 latency, and total storage. Time range selector supports last 24 hours, 7 days, or 30 days. Query volume and rows read trend charts provide billing visibility with per-database breakdown via horizontal bar charts.

Lightweight SVG-based charts require no heavy dependencies. Full accessibility with screen reader support, keyboard navigation, and WCAG-compliant contrast. 2-minute caching per time range for instant dashboard revisits.

πŸ—„οΈ Unified Backup & Restore Hub - NEW in v2.0.0

Single tabbed interface for all backup operations. Replaces separate Undo History and R2 Restore dialogs with a comprehensive backup management experience including multi-select and bulk operations.

The Quick Restore tab undoes recent destructive operations (last 10 dropped tables, columns, deleted rows) with instant restoration and conflict detection. The R2 Backups tab provides full database snapshots in R2 cloud storage with multi-select for bulk download and delete.

The Schedule tab configures automated backup schedules per database with source tags showing backup origin (Manual, Before Rename, Before STRICT Mode, Scheduled). Orphaned backups from deleted databases persist and can be restored even after database deletion.

πŸ›‘οΈ Comprehensive Safety Backups - NEW in v2.0.0

Automatic backups before destructive operations ensure you never lose data with comprehensive safety nets for all high-risk operations.

  • Delete Database: Creates R2 backup before deletion; backup viewable/restorable in Backup & Restore hub
  • Rename Database: Creates R2 backup before rename operation
  • Delete Table: Creates undo snapshot for quick restore
  • Enable STRICT Mode: Creates R2 backup before table conversion
  • Modify Column: Creates undo snapshot before schema changes
  • FTS5 Conversion: Creates undo snapshot when converting FTS5 tables

⚑ Performance Improvements - v2.0.0

Dramatic speed improvements across the application. Parallel processing, client-side caching, and optimized API calls deliver a significantly faster user experience.

ER Diagram now loads with a single API call instead of N+1 calls via the includeSchemas parameter, achieving 60-70% faster load times for databases with many tables. Index Analyzer uses parallel batch processing (5 tables at a time) with 60-second TTL caching.

Comprehensive client-side caching includes:

  • Tables Tab: 5-minute cache for instant tab switching
  • Table Schema: 5-minute cache, invalidated on column modifications
  • R2 Backup Status: 10-minute cache shared across all components
  • Metrics: 2-minute cache per time range
  • Unified Relationship Tabs: All views share single cache entry

Additional optimizations include Cascade Impact Simulator with upfront FK index building, Circular Dependencies Detector with ~65% fewer API calls, and Delete Table dependency check reduced from O(MΓ—N) to O(N) API calls.

✨ UI/UX Improvements - v2.0.0

Enhanced user experience across the board with new view modes, fullscreen graphs, improved job history, and quality-of-life improvements throughout.

Toggle between grid (cards) and list (table) view for databases and tables with sortable columns. List view is default for tables (faster rendering) with view preference persisted to localStorage.

View Foreign Key Editor and ER Diagram in fullscreen mode. Maximize button expands diagram to fill entire viewport; press Escape or click minimize to exit.

Enhanced Job History shows full date/time display instead of relative times, duration column for job execution time, and progress percentage with green highlight at 100%. SQL Console improvements include SQL Formatter with SQLite dialect, SQL Autocomplete Toggle, real-time syntax highlighting powered by Prism.js, word wrap toggle for long queries, inline error squiggles showing exact syntax error positions, and SQL Diff Editor for side-by-side query comparison. Additional UI enhancements include expanded Color Picker (27 colors), sticky navigation with backdrop blur, and external documentation links.

πŸ”§ Additional v2.0.0 Features

Table-Level R2 Backup & Restore adds quick-access Backup and Restore icons to each table card, available in both Grid and List views. STRICT Mode Enhancements include a checkbox in Schema Designer and pre-conversion validation showing blockers (red), warnings (amber), and compatibility status.

Generated Column Support allows creating STORED or VIRTUAL generated columns in Schema Designer with expression editor and syntax validation. Create All Indexes Button provides one-click creation of all recommended indexes on Performance tab with optional R2 backup before proceeding.

Centralized Error Logging converted 337+ ad-hoc console statements to a centralized error logger with structured context. Critical errors automatically trigger webhook notifications.

πŸ› Bug Fixes - v2.0.0

  • Database Rename D1 Eventual Consistency: Added 3-second delay and retry logic for verification
  • R2 Backup Dialog Navigation: Dialogs properly return to parent context after backup completes
  • Undo Restore Table Refresh: Restored tables now appear immediately without page refresh
  • STRICT Mode Conversion Reliability: Fixed D1 REST API request body, index recreation, DEFAULT CURRENT_TIMESTAMP syntax
  • Table Creation Not Updating UI: Fixed cache usage preventing new tables from appearing
  • SQL Validator False Positives: Fixed incorrect keyword misspelling suggestions
  • Database Name Validation: Enforces D1 naming rules (3-63 chars, lowercase, hyphens)
  • Query Console Autocomplete: Fixed popup not closing when clicking into input
  • Cross-Database Search Rate Limiting: Sequential processing with delays to avoid 429 errors
  • SQL Reserved Keywords: Table/column names now properly quoted with double quotes

πŸ“Š Updated Statistics (v2.0.0)

Metricv1.1.0v2.0.0
Total Components55+65+
API Endpoints35+50+
ER Diagram Load TimeBaseline60-70% faster
New FeaturesTime Travel, ReplicationDrizzle ORM, Scheduled Backups, Metrics
CachingBasicComprehensive (5-10 min TTL)

πŸ—οΈ Foundation Features (v1.0.0 - v1.1.0)

Built on the solid foundation of comprehensive database management capabilities including Time Travel, Read Replication, and Job History from v1.1.0:

Database Management

  • Complete CRUD operations
  • Migration-based renaming
  • 10-operation undo/rollback
  • Bulk operations (ZIP archives)
  • Import SQL files up to 5GB

Time Travel & Replication

  • Point-in-time recovery
  • Checkpoint history
  • Read replication control
  • Sessions API integration
  • Region serving info

Foreign Key Tools

  • FK Visualizer/Editor
  • ER relationship diagrams
  • Circular dependency detector
  • Cascade impact simulator
  • Color-coded relationships

Analysis Tools

  • Index Analyzer
  • Constraint Validator
  • FTS5 Full-Text Search
  • Query Console
  • Job History tracking

Row-Level Filtering

  • Type-aware operators
  • OR logic, BETWEEN, IN
  • Filter presets
  • URL persistence
  • SQL injection protection

Deployment Options

  • Cloudflare Workers
  • Docker (multi-arch)
  • Kubernetes ready
  • Zero Trust auth
  • Local development

πŸ“¦ Installation & Upgrade

v2.0.0 is fully backward compatible. For R2 backup features, add the Durable Object binding to your wrangler.toml (Workers only).

Docker Installation:

docker pull writenotenow/d1-manager:latest

Cloudflare Workers Deployment:

npm run build && npx wrangler deploy

Add Durable Object Binding (for R2 backup features):

# Add to wrangler.toml
[[durable_objects.bindings]]
name = "BACKUP_SCHEDULER"
class_name = "BackupScheduler"

[[migrations]]
tag = "v1"
new_classes = ["BackupScheduler"]

πŸ”§ Technical Stack

Frontend: React, TypeScript (strict mode), Vite, Tailwind CSS, shadcn/ui components, ReactFlow for visualizations.

Backend: Cloudflare Workers Runtime API, D1 serverless database with Sessions API, Durable Objects for scheduled backups, R2 for backup storage, Cloudflare Access Zero Trust authentication with JWT, TypeScript 5.9.3 strict mode.

πŸ“š Documentation & Resources

Comprehensive documentation available on GitHub (repository, wiki, release notes, changelog), Docker Hub (multi-architecture images with health checks).

🚧 Roadmap

Completed in v2.0.0:

  • βœ… Analytics dashboard with comprehensive usage metrics (Metrics Dashboard)
  • βœ… Drizzle ORM integration for TypeScript developers
  • βœ… Scheduled automated backups
  • βœ… Enhanced cross-database search with FTS5 support

Still Planned: Dependency export as JSON documentation files, force delete mode with audit logging for power users, AI-assisted query optimization suggestions.

πŸ”— Links

GitHub Release v2.0.0 | GitHub Release v1.1.0 | GitHub Release v1.0.0 | Live Demo