12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class CreateQuoteRecordTable 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('quote_record')->setComment('报价记录表');
- $table->addColumn('area', 'integer', ['limit'=> 5, 'comment'=> '面积', 'default'=> 0])
- ->addColumn('room', 'integer', ['limit'=> 3, 'comment'=> '室', 'default'=> 0])
- ->addColumn('hall', 'integer', ['limit'=> 3, 'comment'=> '厅', 'default'=> 0])
- ->addColumn('bathroom', 'integer', ['limit'=> 3, 'comment'=> '卫', 'default'=> 0])
- ->addColumn('phone', 'string', ['limit'=> 50, 'comment'=> '手机号', 'default'=> ''])
- ->addColumn('uid', 'integer', ['limit'=> 10, 'comment'=> '用户id', 'default'=> 0])
- ->addColumn('employee_id', 'integer', ['limit'=> 10, 'comment'=> '分享人id', 'default'=> 0])
- ->addColumn('root_id', 'integer', ['limit'=> 10, 'comment'=> '组织id', 'default'=> 0])
- ->addColumn('addtime', 'timestamp', ['default'=> 'CURRENT_TIMESTAMP','null' => true])
- ->create();
- }
- }
|