SQL queries to import from a custom CMS into Drupal
The attached text file contains the custom SQL queries I wrote in order to convert and import the database of a custom-written CMS into Drupal. The original site is quite large, with approximately 20,000 users, 100,000 nodes, and 800,000 comments. All nodes are Forum nodes.
If you are converting a custom database to Drupal, some of these queries might be helpful to you, or provide a starting point for your own custom queries. If you’re using a more common open-source CMS, then please check for pre-written conversion scripts, which are available for most popular systems.
These queries were run on a Mac OS X system, running MAMP. Most queries are executed through the Terminal app (you should not execute huge queries with phpMyAdmin). With some modification, you should be able to adapt these commands to work with WAMP or XAMPP if you use Windows, and run commands from the cmd prompt in Windows.
I’m posting this file for others to use, in the hope that it will be useful and help people avoid some of the struggle of preparing data from another system and importing it into Drupal. By using the information in the attached file, you agree that the risk is your own and I take no responsibility. Back up all of your data thoroughly before attempting anything, and work with a duplicate of your database. I also cannot help with your database conversion, beyond the content of this file.
The steps and queries are meant for Drupal 5, however only minor changes are needed for making it work with Drupal 6 - I included a few notes about the relevant changes to the database I’m aware of in Drupal 6, but you should look up a reference of Drupal’s database tables to be sure (there’s likely one on drupal.org, or if not then there is definitely one in the Pro Drupal Development book, which is what I referred to). In the not-distant-future I will be revising my steps for Drupal 6, but cannot guarantee when. I’ve chosen to attach the file instead of including the queries in a code box on the page, since the formatting of the code on the page was a bit broken, and I wasn’t confident that the original content was left unmodified.
Enjoy!
| Attachment | Size |
|---|---|
| drupal-import-sql-queries.txt | 18.63 KB |