20220416071249_create_weworksingle_customer_table.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateWeworksingleCustomerTable 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_customer', ['comment' => '单企业微信外部联系人', 'engine'=>'InnoDB']);
  30. $table->addColumn('userid', 'string', array('limit' => 100, 'comment'=>'所属用户ID'))
  31. ->addColumn('company_id', 'integer', array('limit' => 10, 'comment'=>'所属系统公司'))
  32. ->addColumn('employee_id', 'integer', array('limit' => 10, 'comment'=>'所属员工id'))
  33. ->addColumn('customer_id', 'integer', array('limit' => 10, 'comment'=>'关联系统客户ID'))
  34. ->addColumn('external_userid', 'string', array('limit' => 100, 'comment'=>'外部联系人ID'))
  35. ->addColumn(Column::tinyInteger('status')->setComment('状态:0正常,1删除'))
  36. ->addColumn('deletetime', 'timestamp', array('comment'=>'删除时间'))
  37. ->addColumn('name', 'string', array('limit' => 200, 'comment'=>'联系人名称'))
  38. ->addColumn('avatar', 'string', array('limit'=> 255, 'comment'=>'头像'))
  39. ->addColumn(Column::tinyInteger('type')->setComment('1微信用户,2企业微信用户'))
  40. ->addColumn(Column::tinyInteger('gender')->setComment('性别:0未知,1男性,2女性'))
  41. ->addColumn('unionid', 'string', array('limit'=> 200))
  42. ->addColumn('position', 'string', array('limit'=> 200, 'comment'=>'职位'))
  43. ->addColumn('corp_name', 'string', array('limit' => 200,'comment'=>'所在企业简称'))
  44. ->addColumn('corp_full_name', 'string', array('limit' => 200, 'comment'=>'所在企业全称'))
  45. ->addColumn('external_profile', 'text', array('comment'=>'对外属性'))
  46. ->addColumn('remark', 'string', array('limit'=> 200, 'comment'=>'备注'))
  47. ->addColumn('description', 'string', array('limit'=> 255, 'comment'=>'描述'))
  48. ->addColumn('createtime', 'string', array('limit'=> 20, 'comment'=>'添加时间'))
  49. ->addColumn('tags', 'text', array('comment'=>'所打标签'))
  50. ->addColumn('remark_corp_name', 'string', array('limit'=> 255, 'comment'=>'微信客户备注的企业名称'))
  51. ->addColumn('remark_mobiles', 'string', array('limit'=> 100, 'comment'=>'该成员对此客户备注的手机号码'))
  52. ->addColumn('add_way', 'string', array('limit'=> 10, 'comment'=>'客户来源。0:未知来源1:扫描二维码2:搜索手机号3:名片分享4:群聊5:手机通讯录6:微信联系人8:安装第三方应用时自动添加的客服人员9:搜索邮箱10:视频号主页添加201:内部成员共享202:管理员/负责人分配'))
  53. ->addColumn('oper_userid', 'string', array('limit'=> 100, 'comment'=>'发起添加的userid'))
  54. ->addColumn('state', 'string', array('limit'=> 100, 'comment'=>'企业自定义的state参数'))
  55. ->create();
  56. }
  57. }