12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateMemberWelfareDrawTable 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()
- {
- $this->table('member_welfare_draw', array('id' => true, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'comment' => '会员福利领取表'))
- ->addColumn('user_id', 'integer', array('limit' => 11, 'signed' => false, 'default' => 0, 'comment' => '用户ID'))
- ->addColumn('target_type', 'integer', array('limit' => 11, 'signed' => false, 'default' => 0, 'comment' => '来源类型 1会员专属优惠券 2异业合作券'))
- ->addColumn('target_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'来源ID'))
- ->addColumn('number', 'string',array('limit' => 255, 'default'=> '','comment'=>'福利编号'))
- ->addColumn('name', 'string',array('limit' => 255, 'default'=> '','comment'=>'福利名称'))
- ->addColumn('cost', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'福利价值'))
- ->addColumn('amount', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'福利数量'))
- ->addColumn('start_time', 'date', array('limit' => 10,'signed' => false, 'default' => null, 'comment' => '发放开始时间'))
- ->addColumn('end_time', 'date', array('limit' => 10,'signed' => false, 'default' => null, 'comment' => '发放结束时间'))
- ->addColumn('use_start_time', 'date', array('limit' => 10,'null' => true, 'default' => null, 'comment' => '使用有效开始时间'))
- ->addColumn('use_end_time', 'date', array('limit' => 10,'null' => true,'default' => null, 'comment' => '使用有效结束时间'))
- ->addColumn('exchange_type', 'string', array('limit'=>255, 'default'=> '','comment'=>'兑换方式(target_type=2时需要) 1到店兑换 2线上兑换'))
- ->addColumn('position', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'坑位(exchange_type=2时需要),一个坑位代表一个具体的页面,支持配置这个页面链接的网址'))
- ->addColumn('url', 'string',array('limit' => 255, 'default'=> '','comment'=>'兑换链接(exchange_type=2时需要),填写合作平台的兑换网址'))
- ->addColumn('img', 'string',array('limit' => 255, 'default'=> '','comment'=>'背景图'))
- ->addColumn('code_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'兑换码ID'))
- ->addColumn('user_coupon_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'用户优惠券ID'))
- ->addColumn('check_status', 'integer', array('limit' => 4, 'signed' => false, 'default' => 0, 'comment' => '核销状态,0:未核销,1:已核销'))
- ->addColumn('use_status', 'integer', array('limit' => 4, 'signed' => false, 'default' => 0, 'comment' => '使用状态,0:未,1:已使用'))
- ->addColumn('create_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '创建时间'))
- ->addColumn('update_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '更新时间'))
- ->create();
- }
- }
|