m180112_145718_rabbit_log.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. /**
  5. * Class m180112_145718_rabbit_log
  6. */
  7. class m180112_145718_rabbit_log extends Migration
  8. {
  9. /**
  10. * @inheritdoc
  11. */
  12. public function safeUp()
  13. {
  14. }
  15. /**
  16. * @inheritdoc
  17. */
  18. public function safeDown()
  19. {
  20. echo "m180112_145718_rabbit_log cannot be reverted.\n";
  21. return false;
  22. }
  23. public function up()
  24. {
  25. $tableOptions = null;
  26. if ($this->db->driverName === 'mysql') {
  27. $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="rabbit log"';
  28. }
  29. $this->createTable('{{%rabbit_log}}', [
  30. //'name'=>Schema::TYPE_STRING.'(200) PRIMARY KEY NOT NULL',
  31. 'id'=>Schema::TYPE_PK,
  32. 'channel'=>Schema::TYPE_TEXT.' NULL COMMENT "频道"',
  33. 'queue'=>Schema::TYPE_TEXT.' NULL COMMENT "队列"',
  34. 'msg'=>Schema::TYPE_TEXT.' NULL COMMENT "发送的所有信息"',
  35. 'msg_body'=>Schema::TYPE_TEXT.' NULL COMMENT "信息体"',
  36. 'msg_delivery_tag'=>Schema::TYPE_TEXT.' NULL COMMENT "路由标签"',
  37. 'addtime'=>Schema::TYPE_DATETIME.' NULL COMMENT "操作时间"',
  38. 'describe'=>Schema::TYPE_TEXT.' NULL COMMENT "备注"',
  39. ], $tableOptions);
  40. }
  41. /*
  42. // Use up()/down() to run migration code without a transaction.
  43. public function up()
  44. {
  45. }
  46. public function down()
  47. {
  48. echo "m180112_145718_rabbit_log cannot be reverted.\n";
  49. return false;
  50. }
  51. */
  52. }