20220526211433_drop_field_to_spellgroup_table.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class DropFieldToSpellgroupTable 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. $table = $this->table('spellgroup');
  30. $table->removeColumn('title')
  31. ->removeColumn('start_date')
  32. ->removeColumn('end_date')
  33. ->removeColumn('del')
  34. ->removeColumn('publish')
  35. ->update();
  36. $table->addColumn(Column::tinyInteger('heads_reward_type')->setComment('团长奖励类型')->setDefault(0))
  37. ->addColumn('heads_reward_cont', 'string',array('limit' => 500,'comment'=>'团长奖励的内容'))
  38. ->addColumn('team_member_cont', 'string',array('limit' => 500,'comment'=>'队员奖励'))
  39. ->addColumn('team_ok_type', 'string',array('limit' => 255,'comment'=>'成团规则'))
  40. ->update();
  41. }
  42. }