Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
bulk change file-id to file-name in custom-field using MySql
Hi,
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.
Offline
Re: bulk change file-id to file-name in custom-field using MySql
Caution: untested! Assuming file ids are stored in custom_1
field:
UPDATE textpattern
INNER JOIN txp_file ON textpattern.custom_1 = txp_file.id
SET textpattern.custom_1 = txp_file.filename
WHERE textpattern.custom_1 > ''
Offline
Re: bulk change file-id to file-name in custom-field using MySql
etc wrote #320090:
Caution: untested! Assuming file ids are stored in
custom_1
field:
Works great, thanks a lot 🙌
Offline