20220824091701_create_talkskill_chosen_table.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateTalkskillChosenTable 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('talkskill_chosen')->setComment('精选话术');
  30. $table->addColumn('title', 'string', ['limit'=> 255, 'comment'=> '标题', 'default'=> ''])
  31. ->addColumn('use_count', 'integer', ['limit'=> 10, 'comment'=> '使用次数', 'default'=> 0])
  32. ->addColumn('view_times', 'integer', ['limit'=> 10, 'comment'=> '浏览次数', 'default'=> 0])
  33. ->addColumn('del', 'integer', ['limit'=> 1, 'comment'=> '上下架,1下架', 'default'=> 0])
  34. ->addColumn('addtime', 'timestamp', ['comment'=> '添加时间', 'default'=> 'CURRENT_TIMESTAMP'])
  35. ->addColumn('root_id', 'integer', ['limit'=> 10, 'comment'=> '组织id', 'default'=> 0])
  36. ->addColumn('employee_id', 'integer', ['limit'=> 10, 'comment'=> '员工id', 'default'=> 0])
  37. ->addColumn('user_cate', 'string', ['limit'=> 100, 'comment'=> '适用人群', 'default'=> ''])
  38. ->addColumn('house_type', 'string', ['limit'=> 255, 'comment'=> '房屋类型', 'default'=> ''])
  39. ->addColumn('cate1', 'string', ['limit'=> 255, 'comment'=> '一级分类', 'default'=> ''])
  40. ->addColumn('cate2', 'string', ['limit'=> 255, 'comment'=> '二级分类', 'default'=> ''])
  41. ->create();
  42. }
  43. }