Skip to content

gtunes/phinx

 
 

Repository files navigation

Phinx: Simple PHP Database Migrations

Build Status Latest Stable Version Total Downloads

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.

Check out http://docs.phinx.org for the comprehensive documentation.

Phinx lets you

  • Write database migrations using database agnostic PHP code.
  • Migrate up and down.
  • Migrate on deployment.
  • Get going in less than 5 minutes.
  • Stop worrying about the state of your database.
  • Take advantage of SCM features such as branching.

Compared with other tools, Phinx does not…

  • Write log files. The screen is better.
  • Try to do too much. Migrations only.
  • Have unreadable source code. We aim to be transparent.
  • Rely on a framework. Phinx is independent. Use it with any app.
  • Support anything other than MySQL. Feel free to fork and contribute if you desire.

Install & Run

Composer

The fastest way to install Phinx in your project is using Composer (http://getcomposer.org/).

  1. Install Composer:

    curl -s https://getcomposer.org/installer | php
    
  2. Add Phinx as a dependency to your composer.json file:

    {
        "require": {
            "robmorgan/phinx": "*"
        }
    }
  3. Install Phinx:

    php composer.phar install
    
  4. Execute Phinx:

    php vendor/bin/phinx
    

As a Phar

You can also use the Box application to build Phinx as a Phar archive (http://box-project.org/).

  1. Clone Phinx from GitHub

    git clone git://github.com/robmorgan/phinx.git
    cd phinx
    
  2. Install Composer

    curl -s https://getcomposer.org/installer | php
    
  3. Install the Phinx dependencies

    php composer.phar install
    
  4. Install Box:

    curl -s http://box-project.org/installer.php | php
    
  5. Create a Phar archive

    php box.phar build
    

Contributing

Start by forking Phinx on GitHub: https://github.com/robmorgan/phinx

Next setup your environment for development:

  • curl -s https://getcomposer.org/installer | php
  • php composer.phar install --dev

News & Updates

Follow Rob (@rjm) on Twitter to stay to date (http://twitter.com/_rjm_)

Misc

Version History

0.2.5 (Sunday, 26th May 2013)

  • Added support for Box Phar Archive Packaging
  • Added support for MYSQL_ATTR driver options
  • Fixed a bug where foreign keys cannot be removed
  • Added support for MySQL table collation
  • Updated Composer dependencies
  • Removed verbosity options, now relies on Symfony instead
  • Improved unit tests

0.2.4 (Saturday, 20th April 2013)

  • The Rollback command supports the verbosity parameter
  • The Rollback command has more detailed output
  • Table::dropForeignKey now returns the table instance

0.2.3 (Saturday, 6th April 2013)

  • Fixed a reporting bug when Phinx couldn't connect to a database
  • Added support for the MySQL 'ON UPDATE' function
  • Phinx timestamp is now mapped to MySQL timestamp instead of datetime
  • Fixed a docs typo for the minimum PHP version
  • Added UTF8 support for migrations
  • Changed regex to handle migration names differently
  • Added support for custom MySQL table engines such as MyISAM
  • Added the change method to the migration template

0.2.2 (Sunday, 3rd March 2013)

  • Added a new verbosity parameter to see more output when migrating
  • Support for PHP config files

0.2.1 (Sunday, 3rd March 2013)

  • Broken Release. Do not use!
  • Unit tests no longer rely on the default phinx.yml file
  • Running migrate for the first time does not give php warnings
  • default_migration_table is now actually supported
  • Updated docblocks to 2013.

0.2.0 (Sunday, 13th January 2013)

  • First Birthday Release
  • Added Reversible Migrations
  • Removed options parameter from AdapterInterface::hasColumn()

0.1.7 (Tuesday, 8th January 2013)

  • Improved documentation on the YAML configuration file
  • Removed options parameter from AdapterInterface::dropIndex()

0.1.6 (Sunday, 9th December 2012)

  • Added foreign key support
  • Removed PEAR support
  • Support for auto_increment on custom id columns
  • Bugfix for column default value 0
  • Documentation improvements

0.1.5 (Sunday, 4th November 2012)

  • Added a test command
  • Added transactions for adapters that support it
  • Changing the Table API to use pending column methods
  • Fixed a bug when defining multiple indexes on a table

0.1.4 (Sunday, 21st October 2012)

  • Documentation Improvements

0.1.3 (Saturday, 20th October 2012)

  • Fixed broken composer support

0.1.2 (Saturday, 20th October 2012)

  • Added composer support
  • Now forces migrations to be in CamelCase format
  • Now specifies the database name when migrating
  • Creates the internal log table using its API instead of raw SQL

0.1.1 (Wednesday, 13th June 2012)

  • First point release. Ready for limited production use.

0.1.0 (Friday, 13th January 2012)

  • Initial public release.

License

(The MIT license)

Copyright (c) 2013 Rob Morgan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

PHP Database Migrations for Everyone

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 94.0%
  • Python 3.0%
  • Shell 2.3%
  • Erlang 0.7%