From b38331143668ab1d5e19f21d566da53ed09d27f7 Mon Sep 17 00:00:00 2001 From: yunwuxin <448901948@qq.com> Date: Tue, 7 Mar 2017 23:45:21 +0800 Subject: [PATCH] =?UTF-8?q?Table=E6=B7=BB=E5=8A=A0=E5=87=A0=E4=B8=AA?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/Table.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/db/Table.php b/src/db/Table.php index d014f4f..513ddd7 100644 --- a/src/db/Table.php +++ b/src/db/Table.php @@ -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);