20220508080921_create_weworksingle_chat_file_table.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateWeworksingleChatFileTable 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. $table = $this->table('weworksingle_chat_file', ['comment' => '聊天文件存储信息表', 'engine'=>'InnoDB']);
  30. $table->addColumn('msgid', 'string', array('limit' => 200, 'comment'=>'消息id'))
  31. ->addColumn('filename', 'string', array('limit' => 255, 'comment'=>'文件名称'))
  32. ->addColumn('path', 'string', array('limit' => 255, 'comment'=>'路径'))
  33. ->addColumn(Column::binary('sdkfileid')->setComment('文件sdkfileid'))
  34. ->addColumn('filesize', 'string', array('limit' => 50, 'comment'=>'文件大小'))
  35. ->addColumn('md5sum', 'string', array('limit' => 100,'comment'=>''))
  36. ->addColumn('createtime', 'timestamp', array('default'=> 'CURRENT_TIMESTAMP', 'comment'=>'拉取时间'))
  37. ->create();
  38. }
  39. }