mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-04 14:34:49 +01:00
* method to simplify migrate/create tests * use new assertion for all migration/create tests * move the expected files to test/data/console
37 lines
768 B
PHP
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;
|