Ruby on Rails-like database migration management for PHP http://github.com/nickinuse/php-migrations some (c) 2009/2010 nickinuse@ofmy.info free to share, remix, use in commercial projects, with ot without attribution as long as the source is treated AS-IS without expecting any specific support ;) WARNING Source provided AS-IS and subject to changes, it's advised to test migrations on a temporary database for now. DESCRIPTION The main aim of this project is to provide PHP developers with means of creating non-SQL based migrations and tools to maintain database changes between developers/ different project servers/sandboxes and database adaptors. Whilst there already exist classes and tools for maintaining migrations in PHP, very few of them can generate SQL changes through php functions (or do so through awfully long class/function names). It was my aim to port most of the syntax and functionality from RoR, being the main pioneer of migration-based approach. WHAT IS A DATABASE MIGRATION? A migration is a description of changes made to the database [provided in the up() method] and means to revert them [provided in the down() method]. Migrations allow to automate the tedious process of maintaining the current state of the database between developers/database interfaces, keep track of changes made (with means to undo them if required), make experimenting easy. FEATURES * generic helper functions for database independent SQL generation (e.g. create_table, t_[basic type] for columns etc.; see db methods) * command-line management * timestamp-based migration file naming: avoid conflicts between developers * transaction-based migration execution: prevent erroneous changes to succeed * migration version is stored in a file, which allows easy transfer of migration setup (note: you should exclude/ignore schema.php from sandbox repositories) * open-ended and flexible: provides means to allow for different database adapters, convenient ways to specify function parameters (NB: adaptor implementations are welcome) INSTALLATION/USE rename/copy config.sample.php to config.php and modify it as prompted in comments to get started, launch a console in the directory containing migrate.php and launch: php -f migrate.php help or use the provided convenience shell script db help If wanting to share with another developer, you should ignore schema/ folder or schema.php directly. Have a look at some documentation: http://wiki.github.com/nickinuse/php-migrations
chaimackerman/php-migrations
Ruby on Rails-like database-independent migration syntax and console management
PHP