你如何在 Drupal 的环境之间迁移 CCK 字段? [英] How do you migrate CCK fields between environments in Drupal?

查看:23
本文介绍了你如何在 Drupal 的环境之间迁移 CCK 字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内容构建工具包 (CCK) 是最有用的 Drupal 模块之一.它允许您轻松地将自定义字段添加到内容类型.

The Content Construction Kit (CCK) is one of the most useful Drupal modules. It allows you to easily add custom fields to a content type.

但是,这些新字段是通过 Drupal 本身创建并存储在数据库中的.这意味着,如果您在开发环境中更改 CCK 字段,则需要在测试和生产环境中手动进行相同的更改.

However, these new fields are created through Drupal itself and stored in the database. This means that if you change a CCK field in your development environment you need to manually make the same change in your test and production environments.

更糟糕的是,没有简单的方法可以确定您的环境是否不同步.因此,如果您在将更改投入测试或生产时无意中搞砸或遗漏了更改,您可能永远不会意识到.

Worse, there's no simple way to determine if your environments have gotten out of sync. So if you ever inadvertantly mess up or omit a change as you put it into test or production you may never realise.

我正在寻找一种允许我导出支持的 CCK 字段定义的技术:

I'm looking for a technique that allows me to export CCK field definitions that supports:

  • 导入新环境(显然)
  • 创建新字段

理想情况下,导出还支持:

Ideally the export would also support:

  • 差异化
  • 修改现有字段
  • 删除现有字段
  • 在数据与字段更改发生冲突的情况下的某种冲突解决方案

解决方案越简单、可重复越好.我想避免自定义脚本或 GUI 自动化,除非有一种非常干净的方法来做到这一点.

The simpler and more repeatable the solution the better. I would like to avoid custom scripting or GUI automation unless there is a very clean way to do this.

推荐答案

您是否知道作为标准 cck 包的一部分的 Content Copy 模块?它在某种程度上为字段和整个内容类型提供了导出/导入功能.

Are you aware of the Content Copy module that is part of the standard cck package? It offers export/import functionality for fields and whole content types to some extent.

它本身不提供差异,我不确定它对现有字段的修改效果如何,但它对移动新字段和/或内容类型有很大帮助.

It does not offer diffing by itself, and I'm not sure about how well it does modifications of already existing fields, but it helps a lot for moving new fields and/or content types.

此外,您可以保存来自不同实例的导出输出并在本地对它们进行比较,这样您就可以很好地概览更改(尤其是快速揭示不同步"的情况).

Also, you can save the output of exports from different instances and diff them locally, which gives you a pretty good overview of changes (especially revealing 'out of sync' situations quickly).

启用后,检查/admin/content/types"顶部的新导出和导入选项卡.

After enabling, check the new export and import tabs on top of '/admin/content/types'.

这篇关于你如何在 Drupal 的环境之间迁移 CCK 字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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