1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateIntegral 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()
- {
- $this->table('credits', ['comment' => '积分贡献值表'])
- ->addColumn('employee_id', 'integer', ['comment'=>'员工id' ,'default' => 0])
- ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
- ->addColumn('credits', 'integer', ['comment'=>'积分或者贡献值', 'default' => 0])
- ->addColumn('sum', 'integer', ['comment'=>'当前合计', 'default' => 0])
- ->addColumn('type', 'integer', ['comment'=>'0积分,1贡献值', 'default' => 0])
- ->addColumn('del', 'integer', ['comment'=>'删除', 'default' => 0])
- ->addColumn('json', 'string', ['comment'=>'json', 'default' => ''])
- ->addColumn('remark', 'string', ['comment'=>'备注', 'default' => ''])
- ->addColumn('addtime', 'timestamp', ['comment'=>'添加时间', 'default' => 'CURRENT_TIMESTAMP'])
- ->create();
- $this->table('credits_log', ['comment' => '积分计算记录表'])
- ->addColumn('employee_id', 'integer', ['comment'=>'员工id' ,'default' => 0])
- ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
- ->addColumn('talkskill_id', 'integer', ['comment'=>'话术id或者评论id', 'default' => 0])
- ->addColumn('type', 'integer', ['comment'=>'0话术,1评论', 'default' => 0,'null'=>true])
- ->addColumn('addtime', 'timestamp', ['comment'=>'添加时间', 'default' => 'CURRENT_TIMESTAMP'])
- ->create();
- $this->table('talkskill')
- ->addColumn(Column::integer('approve')->setAfter('videos')->setNullable()->setDefault(1)->setComment('审批,0待审核,1审核通过,2不通过'))
- ->addColumn(Column::integer('aprove_employee_id')->setAfter('approve')->setDefault(0)->setComment('审核人员'))
- ->addColumn('aprove_time', 'datetime', ['comment'=>'审核时间', 'default' => 'CURRENT_TIMESTAMP'])
- ->update();
- $this->table('company')
- ->addColumn(Column::integer('up_talkskill_value')->setAfter('tel')->setNullable()->setDefault(0)->setComment('上传话术获取贡献值数'))
- ->addColumn(Column::integer('answer_talkskill_value')->setAfter('up_talkskill_value')->setNullable()->setDefault(0)->setComment('回答话术获取贡献值数'))
- ->addColumn(Column::string('up_talkskill_intergral')->setAfter('answer_talkskill_value')->setNullable()->setDefault('')->setComment('积分设置'))
- ->addColumn(Column::string('answer_talkskill_intergral')->setAfter('up_talkskill_intergral')->setNullable()->setDefault('')->setComment('积分设置'))
- ->update();
- }
- }
|