20220120091142_add_limit_hour_coupon_table.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class AddLimitHourCouponTable 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('coupon')
  30. ->addColumn('is_limit_hour', 'integer',array('limit' => 10,'default'=>0,'comment'=>'是否限时间段 0 否 1 是'))
  31. ->addColumn('start_hour', 'string',array('limit' => 6,'default'=>'如11:30','comment'=>'开始抢时间如11:30'))
  32. ->addColumn('end_hour', 'string',array('limit' => 6,'default'=>'','comment'=>'结束抢时间 如12:30'))
  33. ->addColumn('limit_receive_type', 'integer',array('limit' => 10,'default'=>10,'comment'=>'10:限制总数 20:限制每天总数'))
  34. ->save();
  35. }
  36. }