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