20221105145534_create_agent_article_table.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateAgentArticleTable 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('agent_article')
  30. ->addColumn('root_id', 'integer', ['comment'=>'企业'])
  31. ->addColumn('employee_id', 'integer', ['comment'=>'员工'])
  32. ->addColumn('title', 'string', ['comment'=>'标题', 'default'=>''])
  33. ->addColumn('file', 'text', ['comment'=>'封面', 'null'=> true])
  34. ->addColumn('type', 'string', ['comment'=>'文件类型', 'default'=>''])
  35. ->addColumn('content', 'text', ['comment'=>'内容', 'null'=> true])
  36. ->addColumn('talkskill', 'text', ['comment'=>'话术', 'null'=> true])
  37. ->addColumn('disable', 'integer', ['comment'=>'开启', 'default'=>0])
  38. ->addColumn('share_num', 'integer', ['comment'=>'分享数量', 'default'=>0])
  39. ->addColumn('clue_num', 'integer', ['comment'=>'线索数量', 'default'=>0])
  40. ->addColumn('addtime', 'integer', ['comment'=>'添加时间', 'default'=>0])
  41. ->addColumn('down_status', 'boolean', ['limit'=>2, 'comment'=>'图片的下载状态', 'default'=>0])
  42. ->addColumn('file_media_id', 'string', ['limit'=> 1000, 'comment'=> '上传腾讯的图片id数组', 'null'=> true])
  43. ->create();
  44. }
  45. }