From eb6935e4a8d6dd5255d5f0382ee6a357effd6de5 Mon Sep 17 00:00:00 2001 From: John Was Date: Thu, 1 Oct 2015 12:20:19 +0200 Subject: [PATCH] add more conditions when reading mysql information_schema to speed it up --- framework/db/mysql/Schema.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/db/mysql/Schema.php b/framework/db/mysql/Schema.php index 530b316..3555562 100644 --- a/framework/db/mysql/Schema.php +++ b/framework/db/mysql/Schema.php @@ -257,7 +257,8 @@ JOIN information_schema.key_column_usage AS kcu ON kcu.constraint_catalog = rc.constraint_catalog AND kcu.constraint_schema = rc.constraint_schema AND kcu.constraint_name = rc.constraint_name -WHERE rc.table_name = :tableName +WHERE rc.constraint_schema = database() AND kcu.table_schema = database() +AND rc.table_name = :tableName AND kcu.table_name = :tableName SQL; $rows = $this->db->createCommand($sql, [':tableName' => $table->name])->queryAll();