Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (21 sloc) 1.27 KB

K3-Migrate Module

A Ko3 Module by John Hobbs


This module provides a DSL and tools for database migrations for Kohana 3.1.x.

It is loosely inspired by Ruby's ActiveRecord::Migration


PHP is not a nice language for DSL's, so there are some dirty hacks and it's a bit verbose. Get over it or pick a new language.

Also, be aware that it is totally possible to create SQL statements that just don't work. K3-Migrate is not that bright, it will try to do stupid things if you tell it to (especially with indexes).


  1. Drop the source in your MODPATH folder.
  2. Add the module to Kohana::modules in your bootstrap.php
  3. Create the directory APPPATH/migrations/


There are examples in the examples directory.

In K3-Migrate there is usually more than one way to do something, but there are four core statements, outlined below.

Each statement is nested inside of a Migration object's up or down methods.