20220907022705_create_weworksingle_external_group_table.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateWeworksingleExternalGroupTable 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')->setComment('企业微信群');
  30. $table->addColumn('name', 'string', ['limit'=> 255, 'comment'=> '群名', 'default'=> ''])
  31. ->addColumn('chat_id', 'string', ['limit'=> 100, 'comment'=> '群id', 'default'=> ''])
  32. ->addColumn('owner', 'string', ['limit'=> 200, 'comment'=> '群主', 'default'=> ''])
  33. ->addColumn('create_time', 'integer', ['limit'=> 10, 'comment'=> '创群时间', 'default'=> 0])
  34. ->addColumn('notice', 'string', ['limit'=> 255, 'comment'=> '群公告', 'default'=> ''])
  35. ->addColumn('member_list', 'text', ['comment'=> '群成员', 'null'=> true])
  36. ->addColumn('admin_list', 'text', ['comment'=> '群管理', 'null'=> true])
  37. ->addColumn('root_id', 'integer', ['limit'=> 10, 'comment'=> '组织id', 'default'=> 0])
  38. ->addColumn('tag_ids', 'string', ['limit'=> 255, 'comment'=> '群标签', 'default'=> ''])
  39. ->addColumn('status', 'integer', ['limit'=> 2, 'comment'=> '群状态0正常,1解散', 'default'=> 0])
  40. ->addColumn('dismiss_time', 'integer', ['limit'=> 10, 'comment'=> '解散时间', 'default'=> 0])
  41. ->create();
  42. }
  43. }