Phinx: Simple PHP Database Migrations
Phinx makes it ridiculousy 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.
Phinx lets you
- Migrate up and down.
- Integrate with PHPUnit.
- Migrate on deployment.
- Get going in less than 5 minutes.
- Stop worrying about the state of your database.
- Write database agnostic PHP code.
- Run
phinx
and magically migrate(TM) to the latest schema. - 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
The fastest way to install Phinx in your project is using Composer (http://getcomposer.org/).
-
Install composer:
curl -s https://getcomposer.org/installer | php
-
Add Phinx as a dependency to your
composer.json
file:{ "require": { "robmorgan/phinx": "*" } }
-
Install Phinx:
php composer.phar install
-
Execute Phinx:
php vendor/bin/phinx
Documentation
Check out http://docs.phinx.org for the comprehensive documentation.
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_)
References
- https://bitbucket.org/drarok/ladder
- https://github.com/ruckus/ruckusing-migrations
- https://github.com/davedevelopment/phpmig
- Ruby On Rails Migrations
- PHPUnit
- Behat
Misc
Version History
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) 2012 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.