M220812090757InsertQimallLinkCategory.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace addons\Course\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220812090757InsertQimallLinkCategory
  6. */
  7. class M220812090757InsertQimallLinkCategory extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. }
  15. /**
  16. * {@inheritdoc}
  17. */
  18. public function safeDown()
  19. {
  20. echo "M220812090757InsertQimallLinkCategory cannot be reverted.\n";
  21. return false;
  22. }
  23. // Use up()/down() to run migration code without a transaction.
  24. public function up()
  25. {
  26. try{
  27. $table ='qimall_link_category';
  28. $this->insert($table, [
  29. 'name' => 'course_cate',
  30. 'title' => '视频课程',
  31. 'pid' => 19,
  32. 'is_list' => 1,
  33. 'remark' => '',
  34. 'status' => 1,
  35. 'created_at' => 1659584481,
  36. 'updated_at' => 1659584481,
  37. ]);
  38. }catch (\Exception $e){
  39. }
  40. }
  41. public function down()
  42. {
  43. echo "M220812090757InsertQimallLinkCategory cannot be reverted.\n";
  44. return false;
  45. }
  46. }