guild/console/migrations/m211018_080608_create_questionnaire_table.php
2021-10-22 17:02:28 +03:00

37 lines
914 B
PHP

<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%questionnaire}}`.
*/
class m211018_080608_create_questionnaire_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%questionnaire}}', [
'id' => $this->primaryKey(),
'category_id' => $this->integer(),
'title' => $this->string(255),
'status' => $this->integer(1),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
'time_limit' => $this->integer(),
]);
$this->addForeignKey('category', 'questionnaire', 'category_id', 'questionnaire_category', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('category', 'questionnaire');
$this->dropTable('{{%questionnaire}}');
}
}