alshabalin/kohana-advanced-migrations

Maintainers

👁 Alshabalin

Package info

github.com/alshabalin/kohana-advanced-migrations

Type:kohana-module

pkg:composer/alshabalin/kohana-advanced-migrations

Statistics

Installs: 15

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2015-03-16 12:46 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT f60b09bb653f85e85ddf9ef371f5b9e18ec1d639

  • Alexei Shabalin <mail.woop@alshabalin.com>

This package is not auto-updated.

Last update: 2026-06-21 02:41:17 UTC


README

Advanced Migrations is a migration module for kohana, the true Rails way.

It uses SQL schemas written by Evopix https://github.com/evopix/kohana-schema

Requirements:

  • PHP 5.4
  • Kohana 3.3 with Database, ORM modules
  • Kohana Advanced ORM module
  • Kohana Schema module

Features:

  • Commands to generate, execute and rollback migrations.

How to use

A typical migration file looks like:

<?
class Create_Comments extends Migration
{
 public function up()
 {
 Schema::create('comments', function($table)
 {
 $table->increments('id');
 $table->integer('user_id')->unsigned();
 $table->integer('article_id')->unsigned();
 $table->text('comment');
 $table->enum('status', ['new', 'published', 'banned'])->default('new');
 $table->timestamps();
 });

 Schema::table('articles', function($table)
 {
 $table->datetime('last_commented_at')->after('content');
 $table->integer('comments_count')->unsigned()->after('content');
 });
 }

 public function down()
 {
 Schema::drop('comments');

 Schema::table('articles', function($table)
 {
 $table->drop_column('last_commented_at');
 $table->drop_column('comments_count');
 });
 }
}
?>

You may want to create a new migration this way:

./minion generate:migration --name=Create_Comments

After all migrations are done, you need to apply all pending migrations:

./minion db:migrate

License

MIT License (c) Alexei Shabalin, 2015