...
1. From your Ushahidi root folder run this from the commandline:./minion --task=migrations:new --group=3-0
...
bin/phinx create -c application/phinx.php DoSomethingWithTheDb
2. A migration template will be created in this folder:
/application/migrations/[group]timestamp_migration_name.php
In our example above, the migration template would be created in:
/application/migrations/3-0
20141105085836_do_something_with_the_db.php
4. Open the template:
Code Block | ||||
---|---|---|---|---|
| ||||
<?php defined('SYSPATH') OR die('No direct script access.') use Phinx\Migration\AbstractMigration; class Migration_3_0_20130318155930DoSomethingWithTheDb extends Minion_Migration_BaseAbstractMigration { /** * RunChange queriesMethod. needed to apply this migration * * @param Kohana_Database $db Database connection */ public function up(Kohana_Database $db) { // $db->query(NULL, 'CREATE TABLE ... '); } /** * Run queries needed to remove this migration * * @param Kohana_Database $db Database connection */ public function down(Kohana_Database $db) { // $db->query(NULL, 'DROP TABLE ... '); } } * * More information on this method is available here: * http://docs.phinx.org/en/latest/migrations.html#the-change-method * * Uncomment this method if you would like to use it. * public function change() { } */ /** * Migrate Up. */ public function up() { } /** * Migrate Down. */ public function down() { } } |
5. Add the necessary queries to the up an down methods
...