Browse Source

fixed cubrid schema primary key detection

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
6a4ed5a1e8
  1. 14
      framework/yii/db/cubrid/Schema.php

14
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 = '';
}
}

Loading…
Cancel
Save