Skip to content

Add rake task to migrate CarrierWave files to ActiveStorage#533

Open
farhan-ahmed1 wants to merge 1 commit intoTarteelAI:mainfrom
farhan-ahmed1:add-backup-migration-rake-task
Open

Add rake task to migrate CarrierWave files to ActiveStorage#533
farhan-ahmed1 wants to merge 1 commit intoTarteelAI:mainfrom
farhan-ahmed1:add-backup-migration-rake-task

Conversation

@farhan-ahmed1
Copy link
Contributor

@farhan-ahmed1 farhan-ahmed1 commented Feb 16, 2026

This pull request adds a rake task to migrate existing database backup files from CarrierWave to ActiveStorage.

Changes:

  • migrate_backups_to_activestorage.rake - Added db_backups:migrate_to_activestorage rake task
  • Migrates DatabaseBackup records from CarrierWave (file) to ActiveStorage (backup_file)
  • Migrates ResourceContent records from CarrierWave (sqlite_db) to ActiveStorage (sqlite_database)
  • Uses memory-safe Tempfile streaming for large files
  • Supports dry-run mode
  • Is idempotent, so it skips already migrated records

Testing:

# Preview migration
DRY_RUN=true rake db_backups:migrate_to_activestorage

# Run migration
rake db_backups:migrate_to_activestorage

@farhan-ahmed1
Copy link
Contributor Author

@naveed-ahmad Please test this task and review. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant