Update Media URLs

Hi,

I have used cloudinary to upload media, and now we have changed our cloudinary accounts and media URL has been chnaged. I am looking a way to update the media URL for all my assests. What would be the best appraoch?

Not sure if the best approach, but I’ve done this in the past connecting to the db itself and using an UPDATE query to modify the path of all URLs.

Something like:

UPDATE files

SET 
  url = REPLACE(url, 'domain1.com', 'domain2.com'),
  formats = REPLACE(formats::text, 'domain1.com', 'domain2.com')::jsonb

However, It’s important to first create a backup of the db and test the query in a local environment to check everything works as expected before doing it in a production environment.

Hope this helps!
Esteban

Hello!
Thanks for the info! I’ll dig a little deeper to get a better grasp.

Best Regards,
michelle

Thanks for helping the question.

Waiting for your discovering!