20220501094048_add_from_to_exam_train.php 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class AddFromToExamTrain 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('exam_emp_result')
  30. ->addColumn('from', 'integer', ['limit'=> 11, 'comment'=>'0试卷考核,1新兵训练营考核,2历史考核' ,'default' => 0])
  31. ->update();
  32. $this->table('train_done_log')
  33. ->addColumn('from', 'integer', ['limit'=> 11, 'comment'=>'0试卷考核,1新兵训练营考核,2历史考核' ,'default' => 0])
  34. ->update();
  35. $this->table('camp')
  36. ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
  37. ->addColumn('title', 'string', ['comment'=>'训练营名称', 'default' => ''])
  38. ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP', 'comment'=>'创建时间'])
  39. ->addColumn('start_date', 'date', ['comment'=>'结束日期', 'null' => true])
  40. ->addColumn('end_date', 'date', ['comment'=>'结束日期', 'null' => true])
  41. ->addColumn('pattern', 'integer', ['limit'=> 11, 'comment'=>'0日期,1闯关' ,'default' => 0])
  42. ->addColumn('time', 'time', ['comment'=>'解锁时间', 'null' => true])
  43. ->addColumn('day', 'integer', ['limit'=> 11, 'comment'=>'间隔天数' ,'default' => 0])
  44. ->addColumn('del', 'integer', ['limit'=> 11, 'comment'=>'删除' ,'default' => 0])
  45. ->addColumn('content', 'text', array('comment'=>'计划内容', 'null' => true))
  46. ->create();
  47. $this->table('camp_employee')
  48. ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
  49. ->addColumn('camp_id', 'integer', ['comment' => '训练营id', 'default' => 0])
  50. ->addColumn('employee_id', 'integer', ['comment' => '指派id', 'default' => 0])
  51. ->addColumn('now', 'integer', ['comment' => '0历史指派,1最新指派', 'default' => 0])
  52. ->addColumn('state', 'string', ['comment'=>'状态', 'default' => ''])
  53. ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP', 'comment'=>'创建时间'])
  54. ->addColumn('approve', 'integer', ['comment' => '0是否提交申请/是否训练,1待审核,2通过,3不通过,4直接转正', 'default' => 0])
  55. ->addColumn('approve_time', 'timestamp', ['null' => true, 'comment'=>'创建时间'])
  56. ->addColumn('speed', 'string', ['comment'=>'进度', 'default' => ''])
  57. ->create();
  58. $this->table('camp_plan')
  59. ->addColumn('root_id', 'integer', ['comment' => '企业id', 'default' => 0])
  60. ->addColumn('camp_id', 'integer', ['comment' => '训练营id', 'default' => 0])
  61. ->addColumn('type', 'integer', ['comment' => '0课程,1试卷', 'default' => 0])
  62. ->addColumn('plan_id', 'integer', ['comment' => '计划id', 'default' => 0])
  63. ->addColumn('title', 'string', ['comment'=>'标题', 'default' => ''])
  64. ->addColumn('con_id', 'integer', ['comment' => '课程或试卷id', 'default' => 0])
  65. ->addColumn('del', 'integer', ['comment' => '删除', 'default' => 0])
  66. ->create();
  67. }
  68. }