Commit 61274843 authored by samw3's avatar samw3

Testing migration addColumn

parent 09f08242
......@@ -37,8 +37,11 @@ class Doctrine_Migration_TestCase extends Doctrine_UnitTestCase
// New migration for the 'migration_classes' directory
$migration = new Doctrine_Migration('migration_classes');
// migrate to version 2
// migrate to version 3
$migration->migrate(2);
// Make sure the column was added
$this->assertTrue(Doctrine_Manager::getInstance()->getTable('User')->hasColumn('field2'));
// now migrate back to original version
$migration->migrate(0);
......
<?php
class AddTable extends Doctrine_Migration
{
public function up()
{
$this->createTable('migration_test', array('field1' => array('type' => 'string')));
}
public function down()
{
$this->dropTable('migration_test');
}
<?php
class AddTable extends Doctrine_Migration
{
public function up()
{
$this->createTable('migration_test', array('field1' => array('type' => 'string')));
$this->addColumn('migration_test', 'field2', 'integer');
}
public function down()
{
$this->dropTable('migration_test');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment