I like to develop on a test site and then push it (or at least the parts I am happy with) live. This has proven to be problematic with Drupal, since the content is stored in a complex and mostly undocumented (being able to back-engineer the code doesn't count as documentation) database.

I have tried to move content with limited success. Transferring database entries causes auto-increment variables and cross-references to be hopelessly askew, resulting in "duplicate index" and other errors.

Has anyone written a tool or script to push appropriate parts from one site to another? Work that so-far seems to be easier to do-again rather than move to another site or a production site include:

  • Custom roles
  • Content nodes (especially PHP)
  • Custom blocks
  • Custom content types
  • Enabled modules, blocks, access, layout, etc.
  • Configured theme(s)
  • Predefined users
  • News feeds
  • Categories
  • Menus
  • Aliases

Some of these are relatively trivial (eg. enabled modules) and some are rather problematic.

Thought I should ask before I roll my own.

TIA

Comments

trailerparkopera’s picture

from one set of tables to a new set. You can do it through the MySQL command line, but I've preferred to use phpmyadmin to help.

The only problem I had was trying to move 1GB worth of files stored in a DB to another DB. Had to resort to the command line and it took forever for me to figure it out.

The problem with writing scripts to do this is that different modules alter core tables: your scripts would have to know (or guess) what modifications were made where.

Are you adding data from one site to another? Or are you simply moving all the data to a new site? If the latter, why not just point your live site to your old data?

lekei’s picture

Yes you can move an entire site from one database to another with a simple export in phpMyAdmin. That is fast and simple -- as long as you include the auto-increment value and set it above the auto-increment value of the old site.

If you just dump the database on one site and import it into the other, all hell breaks loose if you try to add content afterwards.

The problem is that often in a dev site there is a lot of flotsam and jetsam. If, say you just got a form set-up and tweaked or a resturaunt menu working but the live site has data, it is non-trivial to push the new content from one site to the other. It needs to be added to the site, and all the cross-references need to be made.

lekei’s picture

Is there any documantation on the Database yet?

Perhaps I can figure out how to insert things into the database in a way that Drupal knows about it I can write a move-to-live-site function myself. Currently if I try to insert data into another Drupal installation, indexes and counts get messed up (like what the next node number is or user number, etc.).