123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use app\model\Permission;
- class CreateActivitySign 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('activity_sign', ['comment' => '活动报名表', 'engine'=>'InnoDB']);
- $table->addColumn('uid', 'integer',array('comment'=>'客户id','default'=> 0))
- ->addColumn('root_id', 'integer',array('comment'=>'店面id','default'=> 0))
- ->addColumn('aid', 'integer',array('comment'=>'活动id','default'=> 0))
- ->addColumn('share_uid', 'integer',array('comment'=>'分享人uid','default'=> 0))
- ->addColumn('share_employee_id', 'integer',array('comment'=>'分享人业务员id','default'=> 0))
- ->addColumn('qrcode', 'string', ['limit' => 255, 'comment' => '报名二维码', 'null' => true, 'default' => ''])
- ->addColumn('qrcode_con', 'string', ['limit' => 255, 'comment' => '二维码内容', 'null' => true, 'default' => ''])
- ->addColumn('qrcode_status', 'integer',array('comment'=>'是否扫码','default'=> 0))
- ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
- ->create();
- //员工管理增加是否是扫码人员
- $this->table('employee')
- ->addColumn('code_scanning_personnel', 'integer', ['comment' => '是否是活动扫码人员 0否,1是', 'default' => 0])
- ->update();
- //添加权限
- $per3 = ',employee/codeScanning';
- $w3[] = ['auth_name', '=', '员工管理'];
- $info3 = Permission::where($w3)->find();
- $per3 = $info3->relation . $per3;
- $info3->relation = $per3;
- $info3->save();
- }
- }
|