By davidinnes on
I recently imported 3000+ MovableType posts and 14,000+ comments into Drupal with the Table Wizard and Migrate modules. Now, unfortunately I need to change the input format for all posts to Textile (format ID #4 in my system.)
I've looked for modules that would let me do it but I think it's an obscure enough task that nobody's written one.
Is there a more efficient way than hand-editing to do the conversion?
Just a pointer to the right table(s) in the database would be enough since I'm very familiar with SQL, but if there's a proper way to do it with PHP and Drupal hooks (which I'm not so familiar) I'd use that instead. (I'll be backing up the database early and often either way.)
Thanks.
Comments
=-=
node_revisions table format row I think.
Got it!
I don't think I'd have ever looked for it there. It worked perfectly. Thanks, VeryMisunderstood!
---
Example queries:
To backup the database first
mysqldump --add-drop-table -u username -p mydatabasename > mydatabasename_backup.sqlTo convert nodes with the default HMTL (format #2) to custom filter Textile on my site (format #4)
UPDATE node_revisions SET format = 4 WHERE format = 2To convert all nodes on my site to Textile (I was sure that's what I wanted to do, plus I had a backup)
UPDATE node_revisions SET format = 4thanks!
thanks to you both. I'm just figuring out SQL, so your detailed reply with instructions on how to make it work helped immensely. Worked like a charm.
Big Thanks !
Glad that i found the solution here. You are just one step ahead of me asking the question. Nice solution though.
Take a look at
Take a look at http://drupal.org/project/formats_updater
awesome
Just what I was looking for. Not sure it actually works though.
The 'formats_updater' module
The 'formats_updater' module works fine.
But unfortunately it is only available for D6.
For Drupal 7
For Drupal 7, the syntax is:
UPDATE `field_data_body` SET `body_format` = 'markdown'if one wants to change to markdown.
For the name of other available formats, just browse the table
field_data_bodyand look at thebody_formatfield.or
UPDATE `field_data_body` SET `body_format` = 'markdown' WHERE format = 'full html'Convert Body
Is there any way to do this while also running all the node bodies through the current input filter? We are converting a bunch of wiki nodes which are wiki text to html.
Check far and wide
Make sure to check far and wide when updating formats.
This query will get you all the format columns for your content so you can be sure you've been thorough.
select TABLE_NAME, COLUMN_NAME from COLUMNS where TABLE_SCHEMA = 'your_database_name' and COLUMN_NAME like '%format%';This will include some noise. Mine boiled down to this (with lots of fields)...
UPDATE `field_data_body` SET
UPDATE `field_data_body` SET `body_format` = 'markdown'This worked well for me, but I had to clear cache. Thanks!