MySQL: Update json column url property with new domain

31 views Asked by At

I am new to MySQL and would like to get some help regarding below issue.

I am moving my files from my s3 bucket to different provider and my formats column is json object where there are nested objects like large, small, medium, thumbnail (If the original image is small then it may only have thumbnail) which all includes URL property inside it.

I looked into JSON_SET, JSON_REPLACE which could update them but I couldn't get way to update using existing data.

Sample Object:

{
  "large": {
    ...other fields,
    "url": "https://test.s3.amazonaws.com/test.jpeg"
  },
 "small": {
    ...other fields,
    "url": "https://test.s3.amazonaws.com/test.jpeg"
  },
}

I want to change the domain of url to different one but retaining the file name

Expected:

{
  "large": {
    ...other fields,
    "url": "https://example.com/test.jpeg"
  },
 "small": {
    ...other fields,
    "url": "https://example.com/test.jpeg"
  },
}
0

There are 0 answers