问题描述
对版本控制和源代码控制非常陌生我想知道你们中有些人是如何使用Magento安全地将你的开发数据库更新更新为生产的,以及什么工具可以帮你做到。
Being very new to versioning and source control I'm wondering how some of you have gone about safely updating your dev database changes to production using Magento and what tools help you do it.
我有一个存储库设置为我的dev更改和本地机器运行magento的dev版本,但我不知道合并我的数据库更改的安全(和正确的)方式。如果我添加一些产品,添加扩展,在我的dev环境中更改一些管理设置,但想要合并我的更改与正在接受订单,添加客户等的现场商店怎么办?我认为某种类型的合并是适当的,几乎像数据库的源代码控制,但这是可能的吗?
I've got a repository setup for my dev changes and a local machine running a dev version of magento, but I don't know the safe (and proper) way to merge my database changes. What if I add some products, add an extension, change some admin settings in my dev environment but want to merge my changes with a live store that is taking orders, adding customers, etc.? I would think that some type of merge would be appropriate, almost like source control for a database but is this even possible?
我不知道它是否有帮助或事项但我使用NetBeans,我经常使用Navicat浏览数据库表等。
I'm not sure if it helps or matters but I am using NetBeans and I frequently use Navicat to browse through db tables and such.
推荐答案
/ strong>
不太相关 - 因为Magento中的每个模块都可以有自己的。如果感兴趣,可以使用工具来管理数据库的模式,例如。
Versioning Database Schema
Not extremely relevant - since each module in Magento can have its own set of setup/upgrade scripts. If interested though, there are tools for managing the schema of a database, such as dbDeploy.
版本化数据库内容
将环境想象为一组层,顶部是暂存环境,在它下面(在同一层次上)说明开发环境。所有代码更改可以在任何环境中完成,因为所有环境都只是相同版本化源代码的工作副本。每个数据库从下一个层ups环境中抓取。因此,例如,dev环境会从暂存环境中提取数据库,并且当生产环境存在时,分段环境将从那里拉出。因此,对数据库的任何更改(即更新产品,更改配置窗格中的设置等)都必须在最上层进行,然后下面的所有层将在下次更新数据库时接收更改。
现在很明显,当开发时,你可以改变你想要的任何东西,以确保它在你的开发环境下运行良好,然后再使这些变化更高。
Versioning Database Content
Imagining the environments as a set of tiers, at the top is the staging environment, and below it (on the same level) lie the development environment(s). All code changes can be done on any environment since all environments are just working copies of the same versioned source code. Each database is grabbed from the next "tier" ups environment. So for example, a dev environment would pull the database from the staging environment, and when the production environment exists, the staging environment will pull from there. So any changes to the database (ie updating a product, changing a setting in the config pane, etc) has to be done on the uppermost tier, and then all tiers below it will receive the changes the next time they update their database.Now obviously when developing you can change as many things as you want to ensure it works well on your development environment before making those changes higher up.
拉取业务的工作原理
拉取(和推送)数据库非常简单,对数据库执行mysqldump,然后搜索/替换(使用sed或类似东西)网址更改,然后导入新数据库。
How the pulling business works
Pulling (and pushing) the database is pretty simply done, a mysqldump is performed of the database, then search/replaced (using sed or something similar) with the url changes, and then imported into the new database.
说过...
感谢您您的源代码版本化,这至少意味着如果您必须遵循我的方案,您可以在对生产进行更改之前在开发环境中完全测试模块。我希望我能提供更多的具体解决方案 - 因为必须在多个环境中执行更改当然不是理想 - 虽然我会感兴趣的别人带来了。
Having said that...
Kudos to you for having your source code versioned, this at least means that if you do have to follow my scenario, that you can fully test a module on a development environment before making the changes to production. I wish I could offer more of a concrete "solution" - as having to perform changes on multiple environments is certainly not ideal - though I'll be interested what others bring up.
这篇关于如何安全地部署阶段数据库到活的生产数据库在magento的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!