20230814153806_create_designer_customer_plandata_table.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateDesignerCustomerPlandataTable 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('designer_customer_plandata', ['comment' => '设计师客户的方案资料', 'engine'=>'InnoDB']);
  30. $table->addColumn('customer_id', 'integer',array('limit' => 11,'comment'=>'客户id','default'=>0))
  31. ->addColumn('designer_id', 'integer',array('limit' => 10,'comment'=>'设计师id','default'=>0))
  32. ->addColumn('imgurl', 'text',array('comment'=>'图片链接地址','null' => true))
  33. ->addColumn('vrurl', 'text',array('comment'=>'VR案例链接','null' => true))
  34. ->addColumn('pdfurl', 'text',array('comment'=>'PDF链接地址','null' => true))
  35. ->addColumn('root_id', 'integer', array('default' => 0, 'comment'=>'所属企业'))
  36. ->addColumn(Column::tinyInteger('status')->setComment('当前状态')->setDefault(0))
  37. ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
  38. ->create();
  39. }
  40. }