I am using mysql 5.6 and as a result dont have access to existing JSON functions in mysql - so looking for some clever workaround ideas...
I have a Story table in my mysql database that has a field called "tags". Tags is just a string field stores a JSON array of tagIds eg [2,5,6] which relate back to another table called tag. This allows me to easily reconstruct tag information in my UI by combing the json array and the tag data.
However now I need to update those tags in the database and its proving challenging. For example if I want to delete a tag with id = 6 I then need to remove it from all the places its referenced in stories ie
update story set tags = {new tag list excluding 6} where tags used to contain 6
I am unsure how to correctly work with these JSON blobs in mysql.
Likewise in some cases I want to replace a tag with another tag id, ie
update story set tags = {new tag list excluding 6 and including new tag id} where tags used to contain 6
I could retrieve them all and do individual processing from within the server ie Nodejs and update each record individually but seems very inefficient.
What is the correct or desired approach here?