20220908014651_weworksingle_group_member_table.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class WeworksingleGroupMemberTable extends Migrator
  5. {
  6. /**
  7. * Change Method.
  8. *
  9. * Write your reversible migrations using this method.
  10. *
  11. * More information on writing migrations is available here:
  12. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  13. *
  14. * The following commands can be used in this method and Phinx will
  15. * automatically reverse them when rolling back:
  16. *
  17. * createTable
  18. * renameTable
  19. * addColumn
  20. * renameColumn
  21. * addIndex
  22. * addForeignKey
  23. *
  24. * Remember to call "create()" or "update()" and NOT "save()" when working
  25. * with the Table class.
  26. */
  27. public function change()
  28. {
  29. $table = $this->table('weworksingle_group_member')->setComment('群成员');
  30. $table->addColumn('group_id', 'integer', ['limit'=> 10, 'comment'=> '群数据表id', 'default'=> 0])
  31. ->addColumn('chat_id', 'string', ['limit'=> 100, 'comment'=> '群聊id', 'default'=> ''])
  32. ->addColumn('userid', 'string', ['limit'=> 255, 'comment'=> '用户id', 'default'=> ''])
  33. ->addColumn('type', 'integer', ['limit'=> 2, 'comment'=> '成员类型,1 - 企业成员、2 - 外部联系人', 'default'=> 0])
  34. ->addColumn('unionid', 'string', ['limit'=> 255, 'comment'=> '外部联系人在微信开放平台的唯一身份标识(微信unionid)', 'default'=> ''])
  35. ->addColumn('join_time', 'integer', ['limit'=> 10, 'comment'=> '入群时间', 'default'=> 0])
  36. ->addColumn('join_scene', 'integer', ['limit'=> 2, 'comment'=> '入群方式1 - 由群成员邀请入群(直接邀请入群)2 - 由群成员邀请入群(通过邀请链接入群)3 - 通过扫描群二维码入群', 'default'=> 0])
  37. ->addColumn('invitor', 'string', ['limit'=> 255, 'comment'=> '邀请者(json)', 'default'=> ''])
  38. ->addColumn('group_nickname', 'string', ['limit'=> 255, 'comment'=> '群昵称', 'default'=> ''])
  39. ->addColumn('name', 'string', ['limit'=> 255, 'comment'=> '名字。如果是微信用户,则返回其在微信中设置的名字.如果是企业微信联系人,则返回其设置对外展示的别名或实名', 'default'=> ''])
  40. ->addColumn('status', 'integer', ['limit'=> 2, 'comment'=> '在群状态0正常,1退群', 'default'=> 0])
  41. ->addColumn('quit_time', 'integer', ['limit'=> 10, 'comment'=> '退群时间', 'default'=> 0])
  42. ->addColumn('quit_scene', 'integer', ['limit'=> 1, 'comment'=> '退群方式', 'default'=> 0])
  43. ->addColumn('root_id', 'integer', ['limit'=> 10, 'comment'=> '组织id', 'default'=> 0])
  44. ->create();
  45. }
  46. }