4

Summary

Adding PhinxA PHP library to automate the implementation of database changes. to the project to automate database change migration as part of a deployment pipeline.

Overview

Purpose To use PhinxA PHP library to automate the implementation of database changes. to automate database change migration as part of a DevOps deployment process.
Goals
Technology PhinxA PHP library to automate the implementation of database changes.
Resources Primarily the phinx.org website.

Implementation

  1. Install PhinxA PHP library to automate the implementation of database changes.

    This was done in a Terminal window in the Document Root using ComposerUsed to manage the installation of third-party PHP libraries.:

    composer require robmorgan/phinx

  2. Initialize and Configure PhinxA PHP library to automate the implementation of database changes.

  3. Create a PhinxA PHP library to automate the implementation of database changes. Migration

    In the terminal window the below was executed which creates a PHPServer-side scripting language for web development. class file in the directory defined in the phinx.yml file:

    php vendor/bin/phinx create Project004

  4. Write Migration Code

    The class created by PhinxA PHP library to automate the implementation of database changes. was modified to add the implementation of all database objects used by the site so far. During this process a number of tables were restructured to address issues.

  5. Create Link to MySQLRelational database used to hold website content and search data. Socket

    Initial runs of PhinxA PHP library to automate the implementation of database changes. failed on my Macbook, as PhinxA PHP library to automate the implementation of database changes. was not able to find the MySql executables. Following a recommendation on a discussion board the below link was created which resolved the issue:

    cd /var
    sudo mkdir mysql
    cd mysql
    sudo ln -s /Applications/MAMPPersonal webserver stack to allow PHP and MySQL development on MacOS./tmp/mysql/mysql.sock

  6. Execute Migration

    The migration was then run against the development and testing environments:

    vendor/bin/phinx migrate -e development
    vendor/bin/phinx migrate -e testing

    Note: Adding the option -vvv to the commands turns on verbose messaging which can be helpful if the migration fails.