-
Notifications
You must be signed in to change notification settings - Fork 11
Upgrade Guide
This guide helps you upgrade your R2 Bucket Manager metadata database to work with the latest version.
R2 Bucket Manager includes an automated upgrade system with an in-app banner:
- Launch the app - When schema updates are available, a yellow banner appears at the top of the page
- Click "Upgrade Now" - The system automatically applies all pending migrations
- Done! - A green success banner confirms the upgrade completed
The automated system:
- Detects legacy installations and handles them automatically
- Tracks applied migrations in a
schema_versiontable - Is idempotent (safe to run multiple times)
- Shows detailed error messages if something goes wrong
If you deployed R2 Bucket Manager before December 2025, you may need to run migrations. The in-app upgrade banner will automatically detect this.
If you're installing R2 Bucket Manager for the first time, no migration is needed - just use the main schema.sql.
If you prefer to run migrations manually via command line, or if the in-app upgrade isn't accessible:
wrangler d1 execute r2-manager-metadata --remote --file=worker/schema.sqlThis script is idempotent and safe to run multiple times.
The migration system tracks four migrations:
Base schema with bulk_jobs, job_audit_events, and audit_log tables for job tracking and audit logging.
Adds the webhooks table for event notifications (file uploads, downloads, bucket operations, job events).
Adds the bucket_tags table for custom text-based bucket organization and searchable tagging.
Adds the bucket_colors table for visual bucket organization with color tags.
For detailed SQL of each migration, see worker/utils/migrations.ts in the source code.
Check the schema_version table to see applied migrations:
wrangler d1 execute r2-manager-metadata --remote --command="SELECT * FROM schema_version"You should see entries for each applied migration version (1-4).
- Refresh the page to re-check migration status
- Check the browser console for API errors
- Check the error message displayed in the banner
- Verify D1 database binding is correctly configured
- Try the manual migration command as a fallback
This is expected if you run migrations multiple times. The columns already exist, and the error is harmless.
Problem: Migration runs but changes don't appear
Possible Causes:
- Wrong database name
- Using
--localinstead of--remote(or vice versa)
Solution: Verify database name:
wrangler d1 listEnsure you're using the correct database name and flag (--remote for production, --local for development).
If you're running R2 Bucket Manager in Docker:
- The Docker container doesn't include Wrangler
- Run migrations from your local machine with Wrangler installed
- Restart the Docker container after migration
If you're installing R2 Bucket Manager for the first time, skip migrations and use the main schema:
wrangler d1 execute r2-manager-metadata --remote --file=worker/schema.sqlThis includes all migrations already.
For local development, the in-app migration system works the same way. Alternatively:
wrangler d1 execute r2-manager-metadata-dev --local --file=worker/schema.sql| Version | Name | Description |
|---|---|---|
| 1 | initial_schema | Base schema with bulk_jobs, job_audit_events, audit_log |
| 2 | webhooks | Event notification webhooks |
| 3 | bucket_tags | Custom text-based bucket tagging |
| 4 | bucket_colors | Visual bucket organization with colors |
If you encounter any issues with the migration, please open an issue on GitHub with:
- The error message
- Your database binding name
- Whether you're running in production (
--remote) or development (--local) - Output of
wrangler d1 list
- Installation & Setup - Set up R2 Bucket Manager
- Configuration Reference - Environment variables and settings
- Troubleshooting - Common issues and solutions
- Home - Documentation overview
- Quick Start Guide - Get up and running in minutes
- Installation & Setup - Complete deployment guide
- Configuration Reference - Environment variables and settings
- Upgrade Guide - Database schema migrations
- Bucket Management - Create, rename, delete buckets
- Object Lifecycles - Automate expiration and IA transitions ⭐ NEW
- Local Uploads - Faster uploads via nearby edge storage ⭐ NEW
- Job History - Track bulk operations with audit trail ⭐ NEW
- Webhooks - Configure HTTP notifications for events ⭐ NEW
- AI Search - Semantic search with Cloudflare AI
- S3 Import - Migrate from AWS S3 to R2 ⭐ NEW
- Cross-Bucket Search - Search across all buckets with filters
- File Operations - Upload, download, move, copy, delete files
- Folder Management - Organize files hierarchically
- Signed URLs & Sharing - Generate secure shareable links
- Advanced Filtering - Filter by extension, size, and date
- Development Guide - Local setup and development workflow
- API Reference - Complete endpoint documentation
- Architecture Overview - Technical stack and design
- Authentication & Security - Zero Trust implementation
- JWT Validation - JWT token validation and verification
- Troubleshooting - Common issues and solutions
- FAQ - Frequently asked questions
- Roadmap - Planned features and enhancements