1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateMemberWelfareTable 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', array('id' => true, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'comment' => '会员福利表'))
- ->addColumn('target_type', 'integer', array('limit' => 11, 'signed' => false, 'default' => 0, 'comment' => '来源类型 1会员专享券(优惠券只想选一个)2异业合作券(导入文件)'))
- ->addColumn('coupon_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'优惠券ID'))
- ->addColumn('audit_time', 'datetime',array('null' => true,'comment'=>'审核时间'))
- ->addColumn('target_url', 'string',array('limit' => 255, 'default'=> '','comment'=>'导入合作平台或自己平台的券码的excel文件的路径'))
- ->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('draw_amount', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'福利已领数量'))
- ->addColumn('use_up', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'福利已领完:1'))
- ->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('order_at', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'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('codes_file', 'string',array('limit' => 255, 'default'=> '','comment'=>'券码file_id'))
- ->addColumn('audit_status', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'审核状态 0待审核 1审核通过 2审核不通过'))
- ->addColumn('audit_reason', 'string',array('limit' => 255, 'default'=> '','comment'=>'审核不通过原因'))
- ->addColumn('is_delete', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '逻辑删除'))
- ->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();
- }
- }
|