20211118060504_create_user_rice_card_table.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateUserRiceCardTable 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('user_rice_card',array('id' => true,'primary_key' => ['id'],'engine'=>'InnoDB','comment'=>'用户米卡表'))
  30. ->addColumn('user_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'持有用户id'))
  31. ->addColumn('user_mobile', 'string',array('limit' => 255,'default'=>'','comment'=>'持有用户手机号'))
  32. ->addColumn('coupon_no', 'string',array('limit' => 255,'default'=>'','comment'=>'卡号(预留)'))
  33. ->addColumn('coupon_code', 'string',array('limit' => 255,'default'=>'','comment'=>'激活码'))
  34. ->addColumn('card_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'米卡id'))
  35. ->addColumn('card_name', 'string',array('limit' => 255,'default'=>'','comment'=>'米卡名称'))
  36. ->addColumn('type', 'integer',array('limit' => 2,'signed'=>false,'default'=>0,'comment'=>'米卡类型 1-电子套餐卡 2-电子现金卡 3-电子实物兑换卡'))
  37. ->addColumn('describe', 'string',array('limit' => 2550,'default'=>'','comment'=>'米卡说明'))
  38. ->addColumn('content', 'string',array('limit' => 2550,'null' => true, 'default'=>'','comment'=>'米卡详情'))
  39. ->addColumn('image_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'米卡图'))
  40. ->addColumn('expire_time', 'datetime', array('null' => true,'comment'=>'过期时间'))
  41. ->addColumn('face_value', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>0,'signed'=>false,'default'=>0,'comment'=>'面额'))
  42. ->addColumn('balance', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'卡余额'))
  43. ->addColumn('dk_cat_ids', 'string',array('limit' => 255,'default'=>'','comment'=>'抵扣商品类目 默认空 空表示所有类目 多个类目id以逗号分隔'))
  44. ->addColumn('activation_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'激活状态 0 未激活,1已激活'))
  45. ->addColumn('activation_time', 'datetime',array('null' => true,'comment'=>'激活时间'))
  46. ->addColumn('effect_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'生效 状态 0:转赠中 1:生效 2已失效 默认生效 当转赠成功的时侯,变成已失效'))
  47. ->addColumn('parent_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'默认 0 转赠的父id'))
  48. ->addColumn('order_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'默认 订单Id'))
  49. ->addColumn('sign', 'string',array('limit' => 255,'default'=>'','comment'=>'分享签名'))
  50. ->addColumn('frozen_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'冻结状态 0 未冻结 1 已冻结'))
  51. ->addColumn('create_time', 'datetime', array('null' => true,'comment'=>'创建时间'))
  52. ->addColumn('is_delete', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'删除状态 0 未删除 1 已删除'))
  53. ->create();
  54. }
  55. }