1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- use yii\db\Schema;
- use yii\db\Migration;
- class m230918_092622_inquirer_question extends Migration
- {
- public function init()
- {
- $this->db = 'db';
- parent::init();
- }
- public function safeUp()
- {
- $tableOptions = 'ENGINE=InnoDB';
- $this->createTable(
- '{{%inquirer_question}}',
- [
- 'id'=> $this->primaryKey()->unsigned(),
- 'text'=> $this->text()->notNull(),
- 'active'=> "enum('Y', 'N') NOT NULL DEFAULT 'Y' COMMENT 'доступна'",
- 'show'=> "enum('Y', 'N') NOT NULL DEFAULT 'Y' COMMENT 'показывать на главной'",
- 'dt_cr'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
- 'dt_pub'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
- 'dt_end'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
- ],$tableOptions
- );
- }
- public function safeDown()
- {
- $this->dropTable('{{%inquirer_question}}');
- }
- }
|