From afeca7286c7a1ea8f98e58ccc3f429086322a55a Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Mon, 3 May 2021 10:55:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E5=92=8C=E5=88=A0=E9=99=A4=E7=B4=A2=E5=BC=95=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/generate/support/Table.php | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/extend/catcher/generate/support/Table.php b/extend/catcher/generate/support/Table.php index 903c798..595c83c 100644 --- a/extend/catcher/generate/support/Table.php +++ b/extend/catcher/generate/support/Table.php @@ -204,6 +204,30 @@ class Table ])->update(); } + /** + * 删除 index + * + * @time 2021年04月30日 + * @param string $column + * @return void + */ + public static function dropIndex(string $column) + { + self::getTable()->removeIndex([$column])->update(); + } + + /** + * column 是否是索引 + * + * @time 2021年04月30日 + * @param string $column + * @return bool + */ + public static function isIndex(string $column): bool + { + return self::getTable()->hasIndex($column); + } + /** * 获取适配器 *