adding forgotten files

This commit is contained in:
iIronside
2021-10-22 17:02:28 +03:00
parent 2882b8767c
commit e362ad45a4
84 changed files with 21267 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%user_response}}`.
*/
class m211020_133240_create_user_response_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%user_response}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer(),
'question_id' => $this->integer(),
'response_body' => $this->string(),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
'answer_flag' => $this->double(),
'user_questionnaire_id' => $this->integer(),
]);
$this->addForeignKey('user_response', 'user_response', 'user_id', 'user', 'id');
$this->addForeignKey('question_response', 'user_response', 'question_id', 'question', 'id');
$this->addForeignKey(
'questionnaire_response',
'user_response',
'user_questionnaire_id',
'user_questionnaire',
'id'
);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('user_response', 'user_response');
$this->dropForeignKey('question_response', 'user_response');
$this->dropForeignKey('questionnaire_response', 'user_response');
$this->dropTable('{{%user_response}}');
}
}