Textpattern CMS support forum
- THE BLUE DRAGON
- From: Israel
- Registered: 2007-11-16
- Posts: 566
bulk change file-id to file-name in custom-field using MySql
I would like to run a query to change the value of a custom field from the file ID to the file name please.
I’m moving all the files from the site server to Google Cloud Storage, and then I will remove the files from the site server.
I’m using a custom field to assign an ID of a file, so I want to change it to the file name please.
Currently if I will delete the files from the site server and from TXP files-tab, then I will just have meaningless ID numbers in my custom-filed and broken links to the files.
Since there are thousands of files, this will be hell to do it manually.
Re: bulk change file-id to file-name in custom-field using MySql
Caution: untested! Assuming file ids are stored in
UPDATE textpattern INNER JOIN txp_file ON textpattern.custom_1 = txp_file.id SET textpattern.custom_1 = txp_file.filename WHERE textpattern.custom_1 > ''