20220416033504_work_order_table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. final class WorkOrderTable extends AbstractMigration
  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. * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
  13. *
  14. * Remember to call "create()" or "update()" and NOT "save()" when working
  15. * with the Table class.
  16. */
  17. public function change(): void
  18. {
  19. $table = $this->table('work_order');
  20. $table->addColumn('tk_id', 'integer', array('comment' => '围绕主题'))
  21. ->addColumn('is_topic', 'integer', array('comment' => '是否是主题帖'))
  22. ->addColumn('title', 'text', array('comment' => '主题帖标题', 'default' => null, 'null' => true))
  23. ->addColumn('content', 'text', array('comment' => '围绕主题帖的回复内容'))
  24. ->addColumn('user_id', 'integer', array('comment' => '提交用户'))
  25. ->addColumn('created_at', 'integer', array('comment' => '创建时间'))
  26. ->addColumn('updated_at', 'integer', array('comment' => '更新时间'))
  27. ->addColumn('closed_at', 'integer', array('comment' => '关闭时间', 'default' => null, 'null' => true))
  28. ->addColumn('closed_by', 'text', array('comment' => '关闭人', 'default' => null, 'null' => true))
  29. ->create();
  30. }
  31. }