Testing migration addColumn
This commit is contained in:
parent
09f082421b
commit
61274843ed
@ -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);
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user