M230105081906Freepublish.php 881 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. *
  6. * Class M230105081906Freepublish
  7. */
  8. class M230105081906Freepublish extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql = "ALTER TABLE `qimall_wechat_material_article` ADD COLUMN `publish_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '发布id';";
  17. $this->execute($sql);
  18. }catch (\Exception $e){
  19. }
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M230105081906Freepublish cannot be reverted.\n";
  27. return false;
  28. }
  29. /*
  30. // Use up()/down() to run migration code without a transaction.
  31. public function up()
  32. {
  33. }
  34. public function down()
  35. {
  36. echo "M230105081906Freepublish cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }