1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- use yii\db\Schema;
- use yii\db\Migration;
- class m230918_092658_inquirer_answer extends Migration
- {
- public function init()
- {
- $this->db = 'db';
- parent::init();
- }
- public function safeUp()
- {
- $tableOptions = 'ENGINE=InnoDB';
- $this->createTable(
- '{{%inquirer_answer}}',
- [
- 'id'=> $this->primaryKey()->unsigned(),
- 'idq'=> $this->integer()->unsigned()->notNull()->comment('id вопроса'),
- 'text'=> $this->text()->notNull(),
- 'type'=> $this->string(64)->notNull()->defaultValue('simple'),
- 'count'=> $this->integer()->unsigned()->notNull()->defaultValue(0)->comment('счётчик'),
- ],$tableOptions
- );
- $this->createIndex('idq','{{%inquirer_answer}}',['idq'],false);
- }
- public function safeDown()
- {
- $this->dropIndex('idq', '{{%inquirer_answer}}');
- $this->dropTable('{{%inquirer_answer}}');
- }
- }
|