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