20220803085338_update_weworksingle_external_message_table.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class UpdateWeworksingleExternalMessageTable 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_external_message');
  30. $table->drop();
  31. $table->addColumn('root_id', 'integer', ['limit'=> 10, 'comment'=> '组织id', 'default'=> 0])
  32. ->addColumn('send_employee_id', 'text', ['comment'=> '发送员工', 'null'=> true])
  33. ->addColumn('attachments', 'text', ['comment'=> '表单附件json', 'null'=> true])
  34. ->addColumn('attachments_content', 'text', ['comment'=> '转发附件json', 'null'=> true])
  35. ->addColumn('addtime', 'timestamp', ['comment'=> '发送时间', 'default'=> 'CURRENT_TIMESTAMP'])
  36. ->addColumn('repeat', 'integer', ['limit'=> 1, 'comment'=> '是否去重,0否1是', 'default'=> 0])
  37. ->addColumn('condition', 'text', ['comment'=> '筛选条件json', 'null'=> true])
  38. ->addColumn('content', 'text', ['comment'=> '发送文本内容(最多4000字节)', 'null'=> true])
  39. ->addColumn('employee_id', 'integer', ['limit'=> 10, 'comment'=> '创建人', 'default'=> 0])
  40. ->addColumn('user_list', 'text', ['comment'=> '发送用户及接收用户', 'null'=> true])
  41. ->addColumn('external_count', 'integer', ['limit'=> 10, 'comment'=> '外部联系人数量', 'default'=> 0])
  42. ->addColumn('external_send', 'text', ['comment'=> '已发送外部联系人', 'null'=> true])
  43. ->create();
  44. }
  45. }