1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Testing migration addColumn

This commit is contained in:
samw3 2007-10-15 23:39:20 +00:00
parent 09f082421b
commit 61274843ed
2 changed files with 17 additions and 13 deletions

View File

@ -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);

View File

@ -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');
}
}