1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateCustomerPortraitFieldTable 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('customer_portrait_field', ['comment' => '客户画像字段', 'engine'=>'InnoDB']);
- $table->addColumn('name', 'string',array('comment'=>'字段名称'))
- ->addColumn('pid', 'integer',array('comment'=>'上级id','default'=>0))
- ->addColumn(Column::tinyInteger('type')->setComment('字段的类型,1输入框,2数字框,3单选框,4多选框,5日期')->setDefault(1))
- ->addColumn(Column::tinyInteger('isedit')->setComment('是否可编辑0是1否')->setDefault(0))
- ->addColumn(Column::tinyInteger('isdel')->setComment('是否可删除0是1否')->setDefault(0))
- ->addColumn('root_id', 'integer',array('comment'=>'公司id','default'=>1))
- ->addColumn('select', 'string',array('limit' =>2000,'comment'=>'选项','null' => true,'default'=>null))
- ->addColumn(Column::tinyInteger('status')->setComment('是否显示0是1否')->setDefault(0))
- ->addColumn('keyname', 'string',array('limit' =>255,'comment'=>'字段键名称','null' => true))
- ->addColumn('unity', 'string',array('comment'=>'单位','null'=>true))
- ->addColumn(Column::tinyInteger('is_status')->setComment('是否可编辑0是1否')->setDefault(0))
- ->addColumn(Column::tinyInteger('isedit_type')->setComment('是否可编辑填写方式0是1否')->setDefault(0))
- ->addColumn('sort', 'integer', array('comment' => '排序', 'null' => true))
- ->create();
- }
- }
|