Drupal DATABASE 部署策略? [英] Drupal DATABASE deployment strategies?

查看:21
本文介绍了Drupal DATABASE 部署策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自这个项目:什么是最好的 Drupal 部署策略? ....我引用:

From this item: What's best Drupal deployment strategy? .... I quote:

数据库更棘手;清理开发/暂存数据库并将其推送到上线对于初始部署来说是最容易的,但如果上线站点上的用户也在生成内容,则在进行增量数据库更新时会出现一些问题.

Databases are trickier; cleaning up the dev/staging DB and pushing it to live is easiest for the initial rollout but there are a few wrinkles when doing incremental DB updates if users on the live site are also generating content.

我想要一些关于如何做到这一点的想法?目前,我在本地机器上获得了现有数据库的完整副本,提交该颠覆,然后部署整个数据库.目前文件是 15megs,每次我都必须上传整个文件(我认为 subversion 将其视为一个全新的文件,因为每次都有很多变化).

I want some ideas on how to do this? Currently I get a complete copy of the existing db on my local machine, commit that subversion, and then deploy the whole database. Currently the file is 15megs, and each time I have to upload the whole file (i think subversion sees it as a whole new file, because it has so many changes each time).

所以,我的问题是:

  1. 如何在提交时减小我的数据库大小(除了不那么频繁地提交)?
  2. 有没有其他方法可以让我的数据库和服务器数据库保持同步?尤其是考虑到用户会一直发布新数据?

推荐答案

有没有其他方法可以让我的数据库和服务器数据库保持同步?尤其是考虑到用户会一直发布新数据?

Is there any other way to keep my db and server DB in synch? especially considering that users will be posting new data all the time?

我们有一个庞大的分布式团队和到处都是编辑人员,因此部署数据库是不可行的.

We have a large distributed team and editorial staff everywhere so deploying the database is not feasible.

为了解决这个问题,我们广泛使用了更新功能.我们有一个没有真正代码的模块,我们用它来更新设置.每次开发人员进行配置更改时,他们都会在此模块中编写一个更新函数,该函数在运行时将对其他开发数据库(暂存和实时)进行相应的更改.

To get around this we make extensive use of update functions. We have a module which has no real code, which we use for updating settings. Every time a developer makes a configuration change they write an update function in this module which when run will make the corresponding change on the other development DBs, staging and live.

存在问题,尤其是交叉依赖(如果人们在多个模块中编写更新函数),并且在管理中编写相对较小的更改可能需要时间.安装配置文件 api 对此有帮助.

There are issues, particularly with cross dependencies (if people write update functions in more than one module), and it can take time to code something that is a relatively minor change in the admin. Install profile api helps in this.

例如

function mysite_update_6000() {
  install_include(array('user'));
  $editor_rid = install_add_role('editor');
  install_add_permissions(DRUPAL_ANONYMOUS_RID, array('do something'));
  install_add_permissions($editor_rid, array('do something', 'administer nodes'));
  return array();
} 

将添加一个角色并为其分配一些权限.这样做会保留代码中的所有更改,这样您就不必尝试迁移和同步数据库.

Will add a role and assign some permissions to it. Doing this keeps all of the changes in the code so that you don't have to try to migrate and synchronise databases.

还有一个 migration 模块可以帮助解决这个问题,它记录对表的更改并保存它们到更新功能.不要将其与用于内容迁移的 drupal.org 迁移模块混淆.

There is also a migration module which may help with this, it logs changes to tables and saves them to an update function. This is not to be confused with the drupal.org migrate module which is for content migration.

我们取得了一些成功,但features 模块也存在一些问题,这有助于迁移功能.

We have had some success, but also some issues with the features module, which can help with migrating features.

这篇关于Drupal DATABASE 部署策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆