Files
yii2/tests/data/console/migrate_create/add_columns_test.php
Angel Guevara fdbf7d85a1 Simple tests (#11606)
* method to simplify migrate/create tests
* use new assertion for all migration/create tests
* move the expected files to test/data/console
2016-05-24 09:35:23 +03:00

37 lines
768 B
PHP

<?php
return <<<CODE
<?php
use yii\db\Migration;
/**
* Handles adding columns to table `test`.
*/
class {$class} extends Migration
{
/**
* @inheritdoc
*/
public function up()
{
\$this->addColumn('test', 'title', \$this->string(10)->notNull());
\$this->addColumn('test', 'body', \$this->text()->notNull());
\$this->addColumn('test', 'price', \$this->money(11,2)->notNull());
\$this->addColumn('test', 'created_at', \$this->dateTime());
}
/**
* @inheritdoc
*/
public function down()
{
\$this->dropColumn('test', 'title');
\$this->dropColumn('test', 'body');
\$this->dropColumn('test', 'price');
\$this->dropColumn('test', 'created_at');
}
}
CODE;