Yii 1.1: yii-dbmigrations

A database migrations engine for the Yii framework
3 followers

A database migrations engine for the Yii framework. It comes in the form of an extension which can be dropped into any existing Yii framework application.

It relies on the database abstraction layer of the Yii framework to talk to the database engine.

It’s largely inspired on the migrations functionality of the Ruby on Rails framework.

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions
  • Follow the instructions in the README.textile file to install the extension.

Change Log

November 14, 2009 (version 1.1)

  • Fixed a bug where the migrations would fail with Yii version 1.0.10 and 1.1
  • Introduced a new syntax to create tables which is a lot more concise
  • Added the migrate create command
  • Beautified the output from the migrate command
  • Cleaned out the output of the list command
  • Added support for passing on parameters in the execute method of a migration
  • Added the redo command so that the last migration can be re-applied easily
  • When running migrations, a constant called YII_MIGRATING is now defined
  • The migration engine now show the directory in which the migrations are created
  • Replaced the deprecated split function with the explode function to make sure it works fine with PHP 5.3

June 17, 2009 (version 1.0a1)

  • The migrations are now performed inside a database transaction
  • Big code cleanup by adding all needed docstrings
  • When renaming a column, the data type is retained
  • You can now migrate up, down or to a specific version
  • You can now list the status of all migrations

June 15, 2009 (version 0.1a1)

  • Initial announcement.

Total 2 comments

#3252 report it
volkmar at 2011/03/28 05:03pm
Hint

This extension seems to be a part of Yii 1.1.6 now!?

#889 report it
mintao at 2010/02/10 09:41pm
Exactly what I was looking for

Thank you for this great extension. This prevented me from learning java and defining thousands of misterious xml definition files to use "ant".

For using yii-dbmigration under 1.1.1 I had to change a singe line in the CDbMigrationEngine.php in line 118

from

// Check if a database connection was configured
try {
    Yii::app()->db;
} catch (Exception $e) {
    throw new CDbMigrationEngineException(
        'Database configuration is missing in your configuration file.'
    );
}

to

// Check if a database connection was configured
if (!isset(Yii::app()->db)) {
    throw new CDbMigrationEngineException(
        'Database configuration is missing in your configuration file.'
    );
}

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: pclaerhout
  • Category: Database
  • Votes: +5
  • Downloaded: 1,198 times
  • Created on: Jun 15, 2009
  • Last updated: Nov 14, 2009