Drupal on Git, what to do with the database?

前端 未结 2 880
失恋的感觉
失恋的感觉 2021-01-31 00:15

I\'m currently developing a Drupal website with a couple of people on Git; it is important that this website would be using the same database without the path because each devel

相关标签:
2条回答
  • 2021-01-31 01:04

    I'm used to Django, where it's very easy to export a "fixture" (a backup) of the database and store it in a version control system like git. I was recently looking into doing this, but for WordPress. While doing so, I came across some people talking about an awesome command line tool for Drupal called drush: http://drupal.org/project/drush

    This tool allows for some awesome things to be done from the command line, especially when coupled with modules like Backup and Migrate: http://drupal.org/project/backup_migrate

    The basic gist is that you backup the database to an SQL dump when you're pushing/pulling to/from the server, then you can restore the DB afterward. If anything goes wrong, at least you have backup states of the DB in git. That last part is a really big feature, I think.

    Here's a great article on syncing local/live sites with drush and git: https://web.archive.org/web/20131231204544/http://www.opc.com.au/web-development/drupal-release-management-drush-and-git

    Here's how another user deals with including the DB in a git repo: http://drupal.org/creating-drupal-test-sites#comment-2130760

    The issue here is that you'll have to be careful about syncing the DB back to the live site. It's easy and simple to have multiple people grab the latest version of the live DB for testing purposes, but it could be dangerous to push someone's local version of the DB back to production (but only if multiple people are on the same project).

    Just for curiosity's sake, here's a similar question I asked on the WordPress StackExchange site: https://wordpress.stackexchange.com/questions/12239/migrating-data-between-local-and-development-server — I then asked (and answered) a more specific version of the question here: https://wordpress.stackexchange.com/questions/12719/multiple-developers-editors-working-on-a-site-in-progress

    0 讨论(0)
  • 2021-01-31 01:06

    Instead of working at the database level to store your site components, use code. Drupal has now great supports for exportables for views, content type, fields, input formats, etc. with the help of the features module.

    See The Development -> Staging -> Production Workflow Problem in Drupal and the Code driven development: using Features effectively in Drupal 6 and 7 presentation.

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