12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateBuildingTable 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('building')->setComment('vr楼书');
- $table->addColumn('name', 'string', ['limit'=> 255, 'comment'=> '小区名称', 'default'=> ''])
- ->addColumn('pinyin', 'string', ['limit'=> 255, 'comment'=> '小区名称拼音', 'default'=> ''])
- ->addColumn('address', 'string', ['limit'=> 255, 'comment'=> '小区地址', 'default'=> ''])
- ->addColumn('duetime', 'timestamp', ['default'=> null, 'comment'=> '交房时间'])
- ->addColumn('cover', 'string', ['limit'=> 255, 'comment'=> '小区封面', 'default'=> ''])
- ->addColumn('vr_link', 'text', ['comment'=> 'vr链接', 'default'=> null])
- ->addColumn('content', 'text', ['comment'=> '小区简介', 'default'=> null])
- ->addColumn('root_id', 'integer', ['comment'=> '组织id', 'default'=> 0])
- ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP', 'comment'=> '添加时间'])
- ->addColumn('update_time', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP', 'comment'=> '更新时间'])
- ->addColumn('shared_times', 'integer', ['default'=> 0, 'comment'=> '分享次数', 'limit'=> 10])
- ->addColumn(Column::tinyInteger('del')->setComment('是否删除,1删除')->setDefault(0))
- ->create();
- }
- }
|