m230918_092622_inquirer_question.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use yii\db\Schema;
  3. use yii\db\Migration;
  4. class m230918_092622_inquirer_question extends Migration
  5. {
  6. public function init()
  7. {
  8. $this->db = 'db';
  9. parent::init();
  10. }
  11. public function safeUp()
  12. {
  13. $tableOptions = 'ENGINE=InnoDB';
  14. $this->createTable(
  15. '{{%inquirer_question}}',
  16. [
  17. 'id'=> $this->primaryKey()->unsigned(),
  18. 'text'=> $this->text()->notNull(),
  19. 'active'=> "enum('Y', 'N') NOT NULL DEFAULT 'Y' COMMENT 'доступна'",
  20. 'show'=> "enum('Y', 'N') NOT NULL DEFAULT 'Y' COMMENT 'показывать на главной'",
  21. 'dt_cr'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
  22. 'dt_pub'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
  23. 'dt_end'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
  24. ],$tableOptions
  25. );
  26. }
  27. public function safeDown()
  28. {
  29. $this->dropTable('{{%inquirer_question}}');
  30. }
  31. }