12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateDesignerCollectionWorksTable extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('designer_collection_works', ['comment' => '设计师作品集(字段名基本跟material_case表保持一致,以方便跟案例打通)', 'engine'=>'InnoDB']);
- $table->addColumn('title', 'string',array('limit' => 255, 'comment'=>'作品名称'))
- ->addColumn('community_id', 'integer',array('limit' => 10,'comment'=>'小区id','default'=>0))
- ->addColumn('designer_id', 'integer',array('limit' => 10,'comment'=>'设计师id','default'=>0))
- ->addColumn('housetype_id', 'integer',array('limit' => 10,'comment'=>'户型','default'=>0))
- ->addColumn('style_id', 'integer',array('limit' => 10,'comment'=>'风格','default'=>0))
- ->addColumn('cover_img', 'string',array('limit' => 255, 'comment'=>'封面图片','null' => true))
- ->addColumn(Column::decimal('square',6)->setComment('面积')->setDefault(0))
- ->addColumn(Column::decimal('money',7)->setComment('价格')->setDefault(0))
- ->addColumn(Column::tinyInteger('type')->setComment('作品类型1图片,2VR链接')->setDefault(1))
- ->addColumn('desc', 'text',array('comment'=>'内容,图片地址','null' => true))
- ->addColumn('vr_case', 'text',array('comment'=>'VR案例','null' => true))
- ->addColumn('root_id', 'integer', array('default' => 0, 'comment'=>'所属企业'))
- ->addColumn('employee_id', 'integer',array('default' => 0, 'comment'=>'设计师ID'))
- ->addColumn(Column::tinyInteger('status')->setComment('作品当前状态')->setDefault(0))
- ->addColumn('addtime', 'timestamp',array('comment'=>'添加时间','default'=> 'CURRENT_TIMESTAMP'))
- ->create();
- }
- }
|