20220416071236_create_weworksingle_user_table.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateWeworksingleUserTable 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_user', ['comment' => '单企业应用用户', 'engine'=>'InnoDB']);
  30. $table->addColumn('userid', 'string', array('limit' => 100, 'comment'=>'用户ID'))
  31. ->addColumn('company_id', 'integer', array('limit' => 10, 'comment'=>'公司ID'))
  32. ->addColumn('name', 'string', array('limit' => 50, 'comment'=>'用户名'))
  33. ->addColumn('mobile', 'string', array('limit' => 50,'comment'=>'手机号码'))
  34. ->addColumn('department', 'string', array('limit' => 255, 'comment'=>'成员所属部门id列表'))
  35. ->addColumn('order_department', 'string', array('limit'=> 255, 'comment'=>'部门内的排序值'))
  36. ->addColumn('position', 'string', array('limit'=> 200, 'comment'=>'职务信息'))
  37. ->addColumn(Column::tinyInteger('gender')->setComment('性别。0表示未定义,1表示男性,2表示女性。'))
  38. ->addColumn('email', 'string', array('limit'=> 200, 'comment'=>'邮箱'))
  39. ->addColumn('biz_mail', 'string', array('limit'=> 200, 'comment'=>'企业邮箱'))
  40. ->addColumn('is_leader_in_dept', 'string', array('limit'=> 255, 'comment'=>'是否为部门负责人'))
  41. ->addColumn('direct_leader', 'string', array('limit'=> 255, 'comment'=>'直属上级UserID'))
  42. ->addColumn('avatar', 'string', array('limit'=> 255, 'comment'=>'头像'))
  43. ->addColumn('thumb_avatar', 'string', array('limit'=> 255, 'comment'=>'头像缩略图url'))
  44. ->addColumn('telephone', 'string', array('limit'=> 30, 'comment'=>'座机'))
  45. ->addColumn('alias', 'string', array('limit'=> 100, 'comment'=>'别名'))
  46. ->addColumn('extattr', 'text', array('comment'=>'扩展属性'))
  47. ->addColumn(Column::tinyInteger('status')->setComment('激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业'))
  48. ->addColumn('qr_code', 'string', array('limit'=> 200, 'comment'=>'个人二维码'))
  49. ->addColumn('external_profile', 'text', array('comment'=>'成员对外属性'))
  50. ->addColumn('external_position', 'string', array('limit'=> 200, 'comment'=>'对外职务'))
  51. ->addColumn('address', 'string', array('limit'=> 200, 'comment'=>'地址'))
  52. ->addColumn('open_userid', 'string', array('limit'=> 50, 'comment'=>''))
  53. ->addColumn('main_department', 'string', array('limit'=> 20, 'comment'=>'主部门'))
  54. ->addColumn(Column::tinyInteger('chat_record')->setComment('是否开启会话存储:0未开启,1开启'))
  55. ->addColumn('createtime', 'timestamp', array('default'=> 'CURRENT_TIMESTAMP', 'comment'=>'创建时间'))
  56. ->create();
  57. }
  58. }