20220504104933_create_agent_user_table.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateAgentUserTable 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('agent_user', ['comment' => '全民经纪人用户表', 'engine'=>'InnoDB']);
  30. $table->addColumn('agent_name', 'string',array('limit' => 30, 'comment'=>'经纪人姓名'))
  31. ->addColumn('agent_employee_id', 'integer',array('comment'=>'用户ID','null' => true))
  32. ->addColumn('agent_phone', 'string',array('limit' => 11, 'comment'=>'手机号'))
  33. ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
  34. ->addColumn(Column::tinyInteger('type')->setComment('用户当前类型')->setNull(true))
  35. ->addColumn(Column::tinyInteger('status')->setComment('用户当前状态')->setDefault(1))
  36. ->addColumn(Column::tinyInteger('is_review')->setComment('用户当前审核状态')->setDefault(1))
  37. ->addColumn('root_id', 'integer', array('null' => true, 'comment'=>'经济人所属企业'))
  38. ->addColumn('uid', 'integer', array('null' => true, 'comment'=>'经济人关联用户表id'))
  39. ->addColumn('org_id', 'integer', array('null' => true, 'comment'=>'经济人所属部门id'))
  40. ->addColumn(Column::tinyInteger('sex')->setComment('用户性别')->setNull(true))
  41. ->addColumn('review_time', 'integer', array('limit' => 11,'null' => true, 'comment'=>'经济人审核时间'))
  42. ->addColumn('cards_num', 'string',array('limit' => 19, 'comment'=>'经纪人身份证号'))
  43. ->create();
  44. }
  45. }