Closed
Description
How to reproduce:
SQL
CREATE TABLE `tokens` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`token` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `token_UNIQUE` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
PHP
<?php
use Phalcon\Db\Adapter\Pdo\Mysql;
$connection = new Mysql(
[
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'test',
'charset' => 'utf8',
]
);
$indexes = $connection->describeIndexes('tokens');
foreach ($indexes as $index) {
var_dump($index->getType());
}
Actual
string(0) ""
string(0) ""
Expected
string(7) "PRIMARY"
string(6) "UNIQUE"
MySQL
mysql> SHOW INDEXES FROM `tokens`\G
*************************** 1. row ***************************
Table: tokens
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: id
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
*************************** 2. row ***************************
Table: tokens
Non_unique: 0
Key_name: token_UNIQUE
Seq_in_index: 1
Column_name: token
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
2 rows in set (0.01 sec)
Metadata
Metadata
Assignees
Labels
No labels
Activity