Change paths
from django.db.models import F, Value
from django.db.models.functions import Replace
from your_app.models import UploadedFile
# Replace 'your_app' with the actual name of the app where UploadedFile is defined.
# Update paths from development to production
UploadedFile.objects.filter(file__startswith='/home/v3d/fubomatic/media').update(
file=Replace(F('file'), Value('/home/v3d/fubomatic/media'), Value('/home/ubuntu/fubomatic/media'))
)
# Update paths from production to development
UploadedFile.objects.filter(file__startswith='/home/ubuntu/fubomatic/media').update(
file=Replace(F('file'), Value('/home/ubuntu/fubomatic/media'), Value('/home/v3d/fubomatic/media'))
)