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