How to automate migration (schema and data) for PHP/MySQL application

前端 未结 11 2204
鱼传尺愫
鱼传尺愫 2020-12-12 15:32

I have an application in PHP/MySQL. I am searching for an automated way upgrading database behind the application. I don\'t need to have the compatibility with older version

相关标签:
11条回答
  • 2020-12-12 15:58

    You could try this library out: mysql-version-control.

    I like this one because it differentiates between schema, core data and test data. But does it in a way that's still really easy to use.

    0 讨论(0)
  • 2020-12-12 16:03

    Try to use this tool for schema migration: https://github.com/idler/MMP/

    0 讨论(0)
  • 2020-12-12 16:03

    You can't. You either

    1. Write update files with all sql's that were executed on source enviroment and then execute them (mentioned above), SVN-like. Need php script for execution and manual work for sql writing

    2. Post-analyze both enviroments and suggest to user which updates should be migrated. Basically same thing as the first one, except that you have one big step for migration, not lots of small chunks. SQLyog can analyze diffrences for both schema and data.

    0 讨论(0)
  • 2020-12-12 16:03

    I got the same goal : migrating a big database (more than a million lines in some tables). I am considering to use https://phinx.org wich seems good to deal with the schema migration, in addition it comes with rollback option for safety.

    0 讨论(0)
  • 2020-12-12 16:05

    One way you can go about it is to dump the database into a large sql file using mysqldump. Just take that file and source it within the new installation.

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