How to synchronize development and production database

前端 未结 13 2505
春和景丽
春和景丽 2020-12-23 21:53

Do you know any applications to synchronize two databases - during development sometimes it\'s required to add one or two table rows or new table or column. Usually I write

相关标签:
13条回答
  • 2020-12-23 22:04

    Here's a straight linux bash script I wrote for syncing Magento databases... but you can easily modify it for other uses :)

    http://markshust.com/2011/09/08/syncing-magento-instance-production-development

    0 讨论(0)
  • 2020-12-23 22:09

    Siebel (CRM, Sales, etc. management product) has a built-in tool to align the production database with the development one (dev2prod).

    Otherwise, you've got to stick with manually executed scripts.

    0 讨论(0)
  • 2020-12-23 22:10

    Navicat has a structure synchronisation wizard that handles this.

    0 讨论(0)
  • 2020-12-23 22:13

    You asked for a tool or application answer, but what you really need is a a process answer. The underlying theme here is that you should be versioning your database DDL (and DML, when needed) and providing change scripts to be able to update any version of your database to a higher version.

    This set of links provided by Jeff Atwood and written by K. Scott Allen explain in detail what this ought to look like - and they do it better than I can possibly write up here: http://www.codinghorror.com/blog/2008/02/get-your-database-under-version-control.html

    0 讨论(0)
  • 2020-12-23 22:14

    For PostgreSQL you could use Another PostgreSQL Diff Tool . It can diff two SQL Dumps very fast (a few seconds on a db with about 300 tables, 50 views and 500 stored procedures). So you can find your changes easily and get a sql diff which you can execute.

    From the APGDiff Page:

    Another PostgreSQL Diff Tool is simple PostgreSQL diff tool that is useful for schema upgrades. The tool compares two schema dump files and creates output file that is (after some hand-made modifications) suitable for upgrade of old schema.

    0 讨论(0)
  • 2020-12-23 22:16

    You could add some automation to your current way of doing things by using dbDeploy or a similar script. This will allow you to keep track of your schema changes and to upgrade/rollback your schema as you see fit.

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