20220622062949_create_give_out_coupon_table.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateGiveOutCouponTable 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('give_out_coupon', array('id' => true, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'comment' => '发放优惠券记录'))
  30. ->addColumn('coupon_id', 'integer', array('limit' => 10, 'default' => 0, 'comment' => '优惠券ID'))
  31. ->addColumn('rev_type', 'integer', array('limit' => 10, 'default' => 0, 'comment' => '领取方式,1:主动领取,2:被动领取'))
  32. ->addColumn('rev_user', 'integer', array('limit' => 10, 'default' => 0, 'comment' => '发放对象,1:指定用户,2:用户身份,3:按活跃用户'))
  33. ->addColumn('user_type', 'integer', array('limit' => 10, 'default' => 0, 'comment' => '发放对象,1:新用户,2:老用户,7:7日活跃用户,14:14日活跃用户,30:30日活跃用户'))
  34. ->addColumn('mobiles', 'text', array('default' => null, 'null'=>true,'limit' => 65535, 'comment' => '发放手机号码'))
  35. ->addColumn('reason', 'string', array('limit' => 512, 'default' => '', 'comment' => '发放理由'))
  36. ->addColumn('create_admin_id', 'string', array('limit' => 10,'signed'=>false,'default'=>0, 'comment' => '提交人'))
  37. ->addColumn('audit_user_id', 'string', array('limit' => 10,'signed'=>false,'default'=>0, 'comment' => '审核人'))
  38. ->addColumn('audit_time', 'datetime', array('default' => null, 'null'=>true, 'comment' => '审核时间'))
  39. ->addColumn('audit_status', 'integer',array('limit' => 10,'signed'=>false,'default'=>0,'comment'=>'审核状态,0:待审核,1:审核通过,2:审核拒绝'))
  40. ->addColumn('is_delete', 'integer',array('limit' => 10,'signed'=>false,'default'=>0,'comment'=>'是否删除'))
  41. ->addColumn('create_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '创建时间'))
  42. ->addColumn('update_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '更新时间'))
  43. ->create();
  44. }
  45. }