donglian3061 2015-09-16 21:02
浏览 38
已采纳

git中的Wordpress数据库[关闭]

I'm trying to set up a workflow that allows me to develop a single Wordpress theme locally on both my home machine and my laptop since I spend quite a bit of time away. I use git to keep my files all synced up but the issue I'm finding is the database. Currently I can only run Wordpress successfully in the machine I install it in, the other giving me the "Error establishing a database connection", definitely expected as I don't push the database up. My question is, how do I include the Wordpress database in my git repo? Or if that's not possible (or wouldn't even work anyway) is there a way to successfully develop a Wordpress theme on two machines both locally? This front-end dev would really appreciate all you awesome back-end gurus' assistance!

  • 写回答

1条回答 默认 最新

  • du6333137 2015-09-16 21:07
    关注

    The feature you are trying to achieve is called Database Migrations, which is not currently possible using plain PHP and with Git, it is definitely not possible. What you can do is to use some other alternatives like those below:

    1. Ruckusing

      Ruckusing is a framework written in PHP5 for generating and managing a set of "database migrations". Database migrations are declarative files which represent the state of a DB (its tables, columns, indexes, etc) at a particular state of time. By using database migrations, multiple developers can work on the same application and be guaranteed that the application is in a consistent state across all remote developer machines.

      The idea of the framework was borrowed from the migration system built into Ruby on Rails. Any one who is familiar with Migrations in RoR will be immediately at home.

    2. Phinx: Simple PHP Database Migrations

      Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minutes you can install Phinx and create your first database migration. Phinx is just about migrations without all the bloat of a database ORM system or framework.

    3. Phpmig

      Phpmig is a (database) migration tool for php, that should be adaptable for use with most PHP 5.3+ projects. It's kind of like doctrine migrations, without the doctrine. Although you can use doctrine if you want. And ironically, I use doctrine in my examples.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?