This article has been translated by the ultimate guest since: http://phinx.readthedocs.org, bad place, please correct me; series of articles please visit Wang Baiyuan's blog Phinx tab or use geek search: Phinx Get all article directories
A trained developer is good at using the SCM system (Software configuration management: software configuration management) to version control their program code; then why do they not use the same way to version control the database? Phinx allows developers to A clear, concise way to modify and manipulate the database, relying on Phinx provides a powerful API, you do not need to manually write SQL, but use PHP code to create code migration.Developers can then use their favorite SCM for code migration.This allows Phinx code migration to be ported between different database systems.Phinx keeps track of code migrations that have already been done so that you can worry less about the state of the database and focus on developing better software.
The purpose of developing Phinx is as follows:
- Easy porting between common database vendors.
- Independent of the PHP development framework.
- The installation process is simple.
- There is a set of easy-to-use command line operations.
- Integrate with other PHP tools (Phing, PHPUnit) and web frameworks.
Phinx needs to be installed using Composer, a tool that PHP uses to manage dependencies.You can declare the dependent external libraries in your project. Composer will help you install these dependent libraries.For details, please refer to Composer's official website
Note: Phinx supports PHP 5.3.2 version at minimum.
- To install Phinx, just use the composer tool: Run the following command to install (Run PHP commands need to configure the PHP environment variables, add the PHP installation root directory to the environment variable path):
1Php composer.phar require robmorgan/phinx
- Then run composer:
1Php composer.phar install --no-dev
- In your project, create a folder with write permissions for migrations to hold the migration files, and then execute the command in your project folder:
Php vendor/bin/phinx ini
This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!
Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/translation-phinx-introduction-installation-phinx-tutorial-1-2.html