20220811952582_update_daily_wechat_label_field.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. use app\model\Permission;
  5. use app\model\DailyWechatLabel;
  6. class UpdateDailyWechatLabelField extends Migrator
  7. {
  8. /**
  9. * Change Method.
  10. *
  11. * Write your reversible migrations using this method.
  12. *
  13. * More information on writing migrations is available here:
  14. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  15. *
  16. * The following commands can be used in this method and Phinx will
  17. * automatically reverse them when rolling back:
  18. *
  19. * createTable
  20. * renameTable
  21. * addColumn
  22. * renameColumn
  23. * addIndex
  24. * addForeignKey
  25. *
  26. * Remember to call "create()" or "update()" and NOT "save()" when working
  27. * with the Table class.
  28. */
  29. public function change()
  30. {
  31. $this->table('daily_wechat_label')
  32. ->addColumn('show', 'integer',['limit' => 1,'comment'=>'类别是否展示,当类型为其它时不展示','default'=>0])
  33. ->update();
  34. $info = Permission::where('id',17)->find();
  35. $info->relation = $info->relation . ',material/cate_wechat_join_count,material/cate_wechat_delete';
  36. $info->save();
  37. $infos = Permission::where('id',149)->find();
  38. $infos->relation = $infos->relation . ',material/cate_wechat_join_count,material/cate_wechat_delete';
  39. $infos->save();
  40. }
  41. }