20220521021702_create_day_study_setting_table.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateDayStudySettingTable extends Migrator
  5. {
  6. /**
  7. * Change Method.
  8. *
  9. * Write your reversible migrations using this method.
  10. *
  11. * More information on writing migrations is available here:
  12. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  13. *
  14. * The following commands can be used in this method and Phinx will
  15. * automatically reverse them when rolling back:
  16. *
  17. * createTable
  18. * renameTable
  19. * addColumn
  20. * renameColumn
  21. * addIndex
  22. * addForeignKey
  23. *
  24. * Remember to call "create()" or "update()" and NOT "save()" when working
  25. * with the Table class.
  26. */
  27. public function change()
  28. {
  29. $this->table('day_study_setting',['comment' => '每日学练设置'])
  30. ->addColumn(Column::tinyInteger('status')->setComment('是否开启,1开启')->setDefault(0))
  31. ->addColumn('setting', 'text', ['comment' => '设置', 'null'=> true])
  32. ->addColumn('amount', 'integer', ['limit'=> 10, 'comment' => '每日数量', 'default'=> 0])
  33. ->addColumn('starttime', 'integer', ['limit'=> 3, 'comment' => '学习时间段开始时间', 'null'=> true])
  34. ->addColumn('endtime', 'integer', ['limit'=> 3, 'comment'=> '学习时间段结束时间', 'null'=> true])
  35. ->addColumn('root_id', 'integer', ['limit'=> 10,'comment' => '企业id'])
  36. ->addColumn('addtime', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '添加时间'])
  37. ->create();
  38. }
  39. }