Table添加几个快捷方法
This commit is contained in:
parent
efead98edb
commit
b383311436
|
@ -15,18 +15,61 @@ use Phinx\Db\Table\Column;
|
|||
|
||||
class Table extends \Phinx\Db\Table
|
||||
{
|
||||
/**
|
||||
* 设置id
|
||||
* @param $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->options['id'] = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置主键
|
||||
* @param $key
|
||||
* @return $this
|
||||
*/
|
||||
public function setPrimaryKey($key)
|
||||
{
|
||||
$this->options['primary_key'] = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置引擎
|
||||
* @param $engine
|
||||
* @return $this
|
||||
*/
|
||||
public function setEngine($engine)
|
||||
{
|
||||
$this->options['engine'] = $engine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置表注释
|
||||
* @param $comment
|
||||
* @return $this
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->options['comment'] = $comment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置排序比对方法
|
||||
* @param $collation
|
||||
* @return $this
|
||||
*/
|
||||
public function setCollation($collation)
|
||||
{
|
||||
$this->options['collation'] = $collation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addTimestamps($createdAtColumnName = 'create_time', $updatedAtColumnName = 'update_time')
|
||||
{
|
||||
return parent::addTimestamps($createdAtColumnName, $updatedAtColumnName);
|
||||
|
|
Loading…
Reference in New Issue
Block a user