20230727110923_create_designer_collection_works_table.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateDesignerCollectionWorksTable 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_collection_works', ['comment' => '设计师作品集(字段名基本跟material_case表保持一致,以方便跟案例打通)', 'engine'=>'InnoDB']);
  30. $table->addColumn('title', 'string',array('limit' => 255, 'comment'=>'作品名称'))
  31. ->addColumn('community_id', 'integer',array('limit' => 10,'comment'=>'小区id','default'=>0))
  32. ->addColumn('designer_id', 'integer',array('limit' => 10,'comment'=>'设计师id','default'=>0))
  33. ->addColumn('housetype_id', 'integer',array('limit' => 10,'comment'=>'户型','default'=>0))
  34. ->addColumn('style_id', 'integer',array('limit' => 10,'comment'=>'风格','default'=>0))
  35. ->addColumn('cover_img', 'string',array('limit' => 255, 'comment'=>'封面图片','null' => true))
  36. ->addColumn(Column::decimal('square',6)->setComment('面积')->setDefault(0))
  37. ->addColumn(Column::decimal('money',7)->setComment('价格')->setDefault(0))
  38. ->addColumn(Column::tinyInteger('type')->setComment('作品类型1图片,2VR链接')->setDefault(1))
  39. ->addColumn('desc', 'text',array('comment'=>'内容,图片地址','null' => true))
  40. ->addColumn('vr_case', 'text',array('comment'=>'VR案例','null' => true))
  41. ->addColumn('root_id', 'integer', array('default' => 0, 'comment'=>'所属企业'))
  42. ->addColumn('employee_id', 'integer',array('default' => 0, 'comment'=>'设计师ID'))
  43. ->addColumn(Column::tinyInteger('status')->setComment('作品当前状态')->setDefault(0))
  44. ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
  45. ->create();
  46. }
  47. }