From 6a4ed5a1e8619d0811fea43f5994ddb32c00378e Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 17 Nov 2013 00:41:56 +0100 Subject: [PATCH] fixed cubrid schema primary key detection --- framework/yii/db/cubrid/Schema.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/framework/yii/db/cubrid/Schema.php b/framework/yii/db/cubrid/Schema.php index 0b9d0f5..3131fa8 100644 --- a/framework/yii/db/cubrid/Schema.php +++ b/framework/yii/db/cubrid/Schema.php @@ -138,11 +138,15 @@ class Schema extends \yii\db\Schema foreach ($columns as $info) { $column = $this->loadColumnSchema($info); $table->columns[$column->name] = $column; - if ($column->isPrimaryKey) { - $table->primaryKey[] = $column->name; - if ($column->autoIncrement) { - $table->sequenceName = ''; - } + } + + $primaryKeys = $this->db->pdo->cubrid_schema(\PDO::CUBRID_SCH_PRIMARY_KEY, $table->name); + foreach ($primaryKeys as $key) { + $column = $table->columns[$key['ATTR_NAME']]; + $column->isPrimaryKey = true; + $table->primaryKey[] = $column->name; + if ($column->autoIncrement) { + $table->sequenceName = ''; } }