Need to bulk change input filter for 3000+ recently-imported node bodies

davidinnes - November 2, 2009 - 04:45

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.

=-=

VeryMisunderstood - November 2, 2009 - 05:05

node_revisions table format row I think.

Got it!

davidinnes - November 2, 2009 - 06:46

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.sql

To 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 = 2

To 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 = 4

thanks!

keva - November 13, 2009 - 18:19

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.

 
 

Drupal is a registered trademark of Dries Buytaert.