123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateTrainCouresStudytimeTable 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('train_coures_studytime', ['comment' => '员工学习时长记录表', 'engine'=>'InnoDB']);
- $table->addColumn('empid', 'integer',array('comment'=>'员工id','default'=> 0))
- ->addColumn('classid', 'integer',array('comment'=>'课程id','default'=> 0))
- ->addColumn('course_id', 'integer',array('comment'=>'课件id','default'=> 0))
- ->addColumn('study_time', 'integer', array('default'=> 0 ,'comment'=>'学习时长'))
- ->addColumn('all_time', 'integer', array('default'=> 0, 'comment'=>'累计时长'))
- ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
- ->addColumn(Column::tinyInteger('type')->setComment('时长类型')->setDefault(1))
- ->create();
- $table = $this->table('train_credits', ['comment' => '员工学分表', 'engine'=>'InnoDB']);
- $table->addColumn('employee_id', 'integer',array('comment'=>'员工id','default'=> 0))
- ->addColumn('root_id', 'integer',array('comment'=>'公司id','default'=> 0))
- ->addColumn(Column::tinyInteger('type')->setComment('学分类型1是学习时长累计获得,2是课程完成获得,3是写感悟心得获得')->setDefault(0))
- ->addColumn('credits', 'integer', array('default'=> 0 ,'comment'=>'本次增加学分'))
- ->addColumn('now_credits', 'integer', array('default'=> 0, 'comment'=>'累计获得学分'))
- ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
- ->create();
-
- }
- }
|