How to merge Drupal database changes

前端 未结 4 1903
后悔当初
后悔当初 2020-12-31 16:31

We currently use an SVN repository to ensure everyone\'s local environments are kept up-to-date. However, Drupal website development is somewhat trickier in that any custom

相关标签:
4条回答
  • 2020-12-31 16:53

    By committing patches of database dumps, do you mean taking an entire extract of the db and committing it after each change?

    How about a master copy of the database? Extract all tables, views, sps, etc... into individual files, put them into svn and do your merge edits on the individual objects?

    0 讨论(0)
  • 2020-12-31 17:04

    If you are putting php code into your database then you are doing it wrong. Some stuff are inside the database like views and cck fields plus some settings. But if you put php code inside the node body you are creating a big code maintenance problem. You should really use the API and hooks instead. Create modules instead of ugly hacks with eval etc.

    0 讨论(0)
  • 2020-12-31 17:04

    All that has been said above is true and good advice.. To answer your practical question, there are a number of recent modules that you could use to transport the changes done by the various developers.

    The "Features" modules is a cure the the described issue of Drupal often providing nice features, albeit storing lots of configs and structure in the DB. This module enables you to capture a feature and output it as a pseudo-module (qualifies as a module with .info and code-files and all). Here is how it works:

    1. Select functionality/feature to export
    2. The module analyses the modules, files, DB content that is required to rebuild that feature elsewhere
    3. The module creates a pseudo-module that contains the instructions in #3 and outputs everything (even SQL to rebuild the stuff in the DB) into a module package (as well as sets dependencies for other modules required)
    4. Install the pseudo-module on your new site and enable it
    5. The pseudo-module replicates the feature you exported rebuilding DB data and all

    And you can tell your boss you did it all manually with razor focus to avoid even 1 error ;) I hope this helps - http://drupal.org/project/features

    0 讨论(0)
  • 2020-12-31 17:10

    Unfortunately, database deployment/update is one of Drupals weak spots. See this question & answers as well as this one for some suggestions on how to deal with it.

    As for CCK, you could find some hints here.

    As for php code in content, I agree with googletorp in that you should avoid doing this. However, if for some reason you absolutely have to do it, you could try to reduce the code to a simple function call. Thus you'd have the function itself in a module (and this would be tracked via SVN). But then you are only a little step from removing the need for the inline code anyways ...

    0 讨论(0)
提交回复
热议问题