20220524124609_create_wechat_activity_table.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateWechatActivityTable 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('wechat_activity', ['comment' => '微爆活动'])
  30. ->addColumn('root_id', 'integer', ['limit' => 11, 'comment' => '所属企业'])
  31. ->addColumn('title', 'string', ['limit' => 255, 'comment' => '标题'])
  32. ->addColumn('start_date', 'date', ['comment' => '开始时间'])
  33. ->addColumn('end_date', 'date', ['comment' => '结束时间'])
  34. ->addColumn('addtime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '添加时间'])
  35. ->addColumn('schedule_jiav_num', 'integer', ['comment' => '赛程加微任务量', 'default' => 0, 'limit'=>5])
  36. ->addColumn('schedule_meet_num', 'integer', ['comment' => '赛程见面任务量', 'default' => 0, 'limit'=>5])
  37. ->addColumn('schedule_zd_num', 'integer', ['comment' => '赛程转单任务量', 'default' => 0, 'limit'=>5])
  38. ->addColumn('schedule_deposit_num', 'boolean', ['comment' => '赛程收定任务量', 'default' => 0, 'limit'=>3])
  39. ->addColumn('one_jv_integral', 'integer', ['comment' => '添加一个加微多少分', 'default' => 0])
  40. ->addColumn('one_dd_integral', 'integer', ['comment' => '添加一个到店多少分', 'default' => 0])
  41. ->addColumn('one_lf_integral', 'integer', ['comment' => '添加一个量房多少分', 'default' => 0])
  42. ->addColumn('one_qd_integral', 'integer', ['comment' => '添加一个签订多少分', 'default' => 0])
  43. ->addColumn('one_zd_integral', 'integer', ['comment' => '添加一个转单多少分', 'default' => 0])
  44. ->addColumn('ticket', 'string', ['limit' => 255, 'comment' => '活动唯一标识'])
  45. ->addColumn('delete_time', 'integer', ['comment' => '删除时间', 'default' => 0])
  46. ->create();
  47. }
  48. }