1
0

20211202071219_add_root_to_material.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class AddRootToMaterial 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('material_evidence_media')
  30. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  31. ->update();
  32. $this->table('community')
  33. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  34. ->update();
  35. $this->table('designer')
  36. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  37. ->update();
  38. $this->table('decostyle')
  39. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  40. ->update();
  41. $this->table('evidence_cate')
  42. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  43. ->update();
  44. $this->table('material_case')
  45. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  46. ->update();
  47. $this->table('material_evidence')
  48. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  49. ->update();
  50. $this->table('daily_wechat_article')
  51. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  52. ->update();
  53. $this->table('daily_wechat_label')
  54. ->addColumn('root_id', 'integer', ['comment' => '所属企业', 'default' => 1])
  55. ->update();
  56. }
  57. }