1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateWeworksingleCustomerTable extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('weworksingle_customer', ['comment' => '单企业微信外部联系人', 'engine'=>'InnoDB']);
- $table->addColumn('userid', 'string', array('limit' => 100, 'comment'=>'所属用户ID'))
- ->addColumn('company_id', 'integer', array('limit' => 10, 'comment'=>'所属系统公司'))
- ->addColumn('employee_id', 'integer', array('limit' => 10, 'comment'=>'所属员工id'))
- ->addColumn('customer_id', 'integer', array('limit' => 10, 'comment'=>'关联系统客户ID'))
- ->addColumn('external_userid', 'string', array('limit' => 100, 'comment'=>'外部联系人ID'))
- ->addColumn(Column::tinyInteger('status')->setComment('状态:0正常,1删除'))
- ->addColumn('deletetime', 'timestamp', array('comment'=>'删除时间'))
- ->addColumn('name', 'string', array('limit' => 200, 'comment'=>'联系人名称'))
- ->addColumn('avatar', 'string', array('limit'=> 255, 'comment'=>'头像'))
- ->addColumn(Column::tinyInteger('type')->setComment('1微信用户,2企业微信用户'))
- ->addColumn(Column::tinyInteger('gender')->setComment('性别:0未知,1男性,2女性'))
- ->addColumn('unionid', 'string', array('limit'=> 200))
- ->addColumn('position', 'string', array('limit'=> 200, 'comment'=>'职位'))
- ->addColumn('corp_name', 'string', array('limit' => 200,'comment'=>'所在企业简称'))
- ->addColumn('corp_full_name', 'string', array('limit' => 200, 'comment'=>'所在企业全称'))
- ->addColumn('external_profile', 'text', array('comment'=>'对外属性'))
- ->addColumn('remark', 'string', array('limit'=> 200, 'comment'=>'备注'))
- ->addColumn('description', 'string', array('limit'=> 255, 'comment'=>'描述'))
- ->addColumn('createtime', 'string', array('limit'=> 20, 'comment'=>'添加时间'))
- ->addColumn('tags', 'text', array('comment'=>'所打标签'))
- ->addColumn('remark_corp_name', 'string', array('limit'=> 255, 'comment'=>'微信客户备注的企业名称'))
- ->addColumn('remark_mobiles', 'string', array('limit'=> 100, 'comment'=>'该成员对此客户备注的手机号码'))
- ->addColumn('add_way', 'string', array('limit'=> 10, 'comment'=>'客户来源。0:未知来源1:扫描二维码2:搜索手机号3:名片分享4:群聊5:手机通讯录6:微信联系人8:安装第三方应用时自动添加的客服人员9:搜索邮箱10:视频号主页添加201:内部成员共享202:管理员/负责人分配'))
- ->addColumn('oper_userid', 'string', array('limit'=> 100, 'comment'=>'发起添加的userid'))
- ->addColumn('state', 'string', array('limit'=> 100, 'comment'=>'企业自定义的state参数'))
- ->create();
- }
- }
|