Skip to content

migrate-assets

Processing topic: CR-001: Update Authentication (topic-98765) Found 3 asset(s) Asset: design_doc.pdf (MID: asset-11111) Current provider: GridFS (default) Field: documents Target provider MID: mssharepoint-site-1 Target folder: ChangeRequests/{title} Status: Needs migration Starting migration... Downloading from old provider... Uploading to new provider... New storage ID: 01ABCDEFGHIJKLMNOPQRSTUVWXYZ Updated asset CI Removing from old provider... Migration completed ✓ Asset: screenshot.png (MID: asset-22222) Current provider MID: mssharepoint-site-1 Field: documents Target provider MID: mssharepoint-site-1 Status: Already migrated ✓ ...

====================================================================== Migration Summary ====================================================================== Total assets found: 30 Already migrated: 5 Successfully migrated: 23 Failed migrations: 2

Errors encountered: - Asset old_file.doc (asset-99999): Could not retrieve file data from old provider

Done! ```

Safety Features

  • The script checks if assets are already in the target provider before migrating
  • It provides detailed progress output for each asset
  • Failed migrations are reported but don't stop the script
  • Only removes files from the old provider after successful upload to the new provider
  • Optional limit parameter allows testing with a small number of topics (e.g., 1) before processing all topics
  • The script can be safely run multiple times - already migrated assets will be skipped

Troubleshooting

Error: "Category 'X' not found"

  • Verify the category name is spelled correctly
  • Category names are case-sensitive

Error: "Could not instantiate new provider"

  • Check that the storage provider CI is properly configured
  • Verify the provider MID exists in the database

Error: "Could not retrieve file data from old provider"

  • The file may have been manually deleted from the old provider
  • The old provider may be misconfigured or unreachable

Error: "Could not upload file to new provider"

  • Check the target storage provider configuration and credentials
  • Verify network connectivity to the storage provider (e.g., SharePoint)
  • Check storage provider permissions and quotas

Notes

  • The script matches each asset to its specific field configuration, ensuring the correct storage provider and folder are used
  • If a topic has multiple document fields with different providers, each asset will be migrated to its corresponding field's provider
  • GridFS is considered the "default" provider when storage_provider_mid is not set on an asset
  • Use the optional limit parameter to test with a small number of topics before running on all topics