1
0

20220115020727_create_integral.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateIntegral 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. $this->table('credits', ['comment' => '积分贡献值表'])
  30. ->addColumn('employee_id', 'integer', ['comment'=>'员工id' ,'default' => 0])
  31. ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
  32. ->addColumn('credits', 'integer', ['comment'=>'积分或者贡献值', 'default' => 0])
  33. ->addColumn('sum', 'integer', ['comment'=>'当前合计', 'default' => 0])
  34. ->addColumn('type', 'integer', ['comment'=>'0积分,1贡献值', 'default' => 0])
  35. ->addColumn('del', 'integer', ['comment'=>'删除', 'default' => 0])
  36. ->addColumn('json', 'string', ['comment'=>'json', 'default' => ''])
  37. ->addColumn('remark', 'string', ['comment'=>'备注', 'default' => ''])
  38. ->addColumn('addtime', 'timestamp', ['comment'=>'添加时间', 'default' => 'CURRENT_TIMESTAMP'])
  39. ->create();
  40. $this->table('credits_log', ['comment' => '积分计算记录表'])
  41. ->addColumn('employee_id', 'integer', ['comment'=>'员工id' ,'default' => 0])
  42. ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
  43. ->addColumn('talkskill_id', 'integer', ['comment'=>'话术id或者评论id', 'default' => 0])
  44. ->addColumn('type', 'integer', ['comment'=>'0话术,1评论', 'default' => 0,'null'=>true])
  45. ->addColumn('addtime', 'timestamp', ['comment'=>'添加时间', 'default' => 'CURRENT_TIMESTAMP'])
  46. ->create();
  47. $this->table('talkskill')
  48. ->addColumn(Column::integer('approve')->setAfter('videos')->setNullable()->setDefault(1)->setComment('审批,0待审核,1审核通过,2不通过'))
  49. ->addColumn(Column::integer('aprove_employee_id')->setAfter('approve')->setDefault(0)->setComment('审核人员'))
  50. ->addColumn('aprove_time', 'datetime', ['comment'=>'审核时间', 'default' => 'CURRENT_TIMESTAMP'])
  51. ->update();
  52. $this->table('company')
  53. ->addColumn(Column::integer('up_talkskill_value')->setAfter('tel')->setNullable()->setDefault(0)->setComment('上传话术获取贡献值数'))
  54. ->addColumn(Column::integer('answer_talkskill_value')->setAfter('up_talkskill_value')->setNullable()->setDefault(0)->setComment('回答话术获取贡献值数'))
  55. ->addColumn(Column::string('up_talkskill_intergral')->setAfter('answer_talkskill_value')->setNullable()->setDefault('')->setComment('积分设置'))
  56. ->addColumn(Column::string('answer_talkskill_intergral')->setAfter('up_talkskill_intergral')->setNullable()->setDefault('')->setComment('积分设置'))
  57. ->update();
  58. }
  59. }