123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateUserRiceCardTable extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('user_rice_card',array('id' => true,'primary_key' => ['id'],'engine'=>'InnoDB','comment'=>'用户米卡表'))
- ->addColumn('user_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'持有用户id'))
- ->addColumn('user_mobile', 'string',array('limit' => 255,'default'=>'','comment'=>'持有用户手机号'))
- ->addColumn('coupon_no', 'string',array('limit' => 255,'default'=>'','comment'=>'卡号(预留)'))
- ->addColumn('coupon_code', 'string',array('limit' => 255,'default'=>'','comment'=>'激活码'))
- ->addColumn('card_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'米卡id'))
- ->addColumn('card_name', 'string',array('limit' => 255,'default'=>'','comment'=>'米卡名称'))
- ->addColumn('type', 'integer',array('limit' => 2,'signed'=>false,'default'=>0,'comment'=>'米卡类型 1-电子套餐卡 2-电子现金卡 3-电子实物兑换卡'))
- ->addColumn('describe', 'string',array('limit' => 2550,'default'=>'','comment'=>'米卡说明'))
- ->addColumn('content', 'string',array('limit' => 2550,'null' => true, 'default'=>'','comment'=>'米卡详情'))
- ->addColumn('image_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'米卡图'))
- ->addColumn('expire_time', 'datetime', array('null' => true,'comment'=>'过期时间'))
- ->addColumn('face_value', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>0,'signed'=>false,'default'=>0,'comment'=>'面额'))
- ->addColumn('balance', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'卡余额'))
- ->addColumn('dk_cat_ids', 'string',array('limit' => 255,'default'=>'','comment'=>'抵扣商品类目 默认空 空表示所有类目 多个类目id以逗号分隔'))
- ->addColumn('activation_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'激活状态 0 未激活,1已激活'))
- ->addColumn('activation_time', 'datetime',array('null' => true,'comment'=>'激活时间'))
- ->addColumn('effect_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'生效 状态 0:转赠中 1:生效 2已失效 默认生效 当转赠成功的时侯,变成已失效'))
- ->addColumn('parent_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'默认 0 转赠的父id'))
- ->addColumn('order_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'默认 订单Id'))
- ->addColumn('sign', 'string',array('limit' => 255,'default'=>'','comment'=>'分享签名'))
- ->addColumn('frozen_state', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'冻结状态 0 未冻结 1 已冻结'))
- ->addColumn('create_time', 'datetime', array('null' => true,'comment'=>'创建时间'))
- ->addColumn('is_delete', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'删除状态 0 未删除 1 已删除'))
- ->create();
- }
- }
|