Update URLs inside a poll after changing CDN

i just read this post and if you haven’t fixed it already since, i think you may be able to do this with the built in discourse remap function.

unlike the rake task, discourse remap uses DbHelper.remap which executes a global regex search-and-replace across all text columns in all tables in the postgreSQL database. it should successfully find and update the baked CDN URLs trapped inside poll_options.html (as well as any other tables the rake task skips).

cd /var/discourse
./launcher enter app
# create a safety backup
discourse backup
# run the global remap (domain only with no protocol so to catch all variations)
discourse remap 'cdn.unicyclist.com' 'unicyclist.com'
# clear the redis cache (crucial since discourse heavily caches baked html)
rake cache:clear

i did something similar here (but going the other direction): Chat thumbnails bypass s3_cdn_url & use raw S3 bucket URLs - #8 by Lilly