123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use app\model\Permission;
- class CreateDailyTasks 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('daily_tasks', ['comment' => '日常任务'])
- ->addColumn('root_id', 'integer', ['comment' => '企业id', 'limit'=>11,'default' => 0])
- ->addColumn('type', 'string', ['limit' => 255,'null' => true, 'default'=>'', 'comment'=>'类型'])
- ->addColumn('con_id', 'integer', ['comment' => '内容id', 'limit'=>11,'default' => 0])
- ->addColumn('org_ids', 'string', ['limit' => 255,'null' => true, 'default'=>'', 'comment'=>'指派组织id'])
- ->addColumn('addtime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '添加时间'])
- ->addColumn('end_date', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '结束时间'])
- ->addColumn('del', 'integer', ['comment' => '删除', 'limit'=>11,'default' => 0])
- ->addColumn('employee_ids', 'text', ['comment'=> '完成人员id', 'null' => true,'default'=> null])
- ->addColumn('grawth', 'string', ['limit' => 255,'null' => true, 'default'=>'', 'comment'=>'完成率'])
- ->create();
- $q = ',dailyTasks/assign_org,dailyTasks/get_orgs,dailyTasks/get_person,dailyTasks/assign_org_edit,dailyTasks/del_assign,dailyTasks/save_date';
- $menu = Permission::where('auth_name','任务中心')->find();
- $menu->relation = $menu->relation.$q;
- $menu->save();
- }
- }
|