20221211083206_create_async_task_table.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateAsyncTaskTable 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('async_task', ['comment'=>'异步处理表'])
  30. ->addColumn('root_id', 'integer', ['comment'=>'企业编号'])
  31. ->addColumn('method', 'string', ['comment'=>'处理方法'])
  32. ->addColumn('params', 'json', ['comment'=>'处理参数'])
  33. ->addColumn('state', 'boolean', ['comment'=>'是否处理完成', 'default'=>0])
  34. ->addColumn('addtime', 'integer', ['comment'=>'添加时间'])
  35. ->addColumn('complete_time', 'integer', ['comment'=>'完成时间', 'null'=>true])
  36. ->addColumn('result', 'string', ['comment'=>'完成结果', 'null'=>true])
  37. ->create();
  38. }
  39. }