m230918_092723_inquirer_log.php 878 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use yii\db\Schema;
  3. use yii\db\Migration;
  4. class m230918_092723_inquirer_log 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_log}}',
  16. [
  17. 'id'=> $this->primaryKey()->unsigned(),
  18. 'idq'=> $this->integer()->unsigned()->notNull(),
  19. 'hash'=> $this->string(64)->notNull(),
  20. 'dt'=> $this->timestamp()->notNull()->defaultExpression("CURRENT_TIMESTAMP"),
  21. ],$tableOptions
  22. );
  23. $this->createIndex('idq','{{%inquirer_log}}',['idq'],false);
  24. }
  25. public function safeDown()
  26. {
  27. $this->dropIndex('idq', '{{%inquirer_log}}');
  28. $this->dropTable('{{%inquirer_log}}');
  29. }
  30. }