Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missed index type on Phalcon\Db\Adapter\Pdo\Mysql::describeIndexes #11036

Closed
sergeyklay opened this issue Oct 20, 2015 · 2 comments
Closed

Missed index type on Phalcon\Db\Adapter\Pdo\Mysql::describeIndexes #11036

sergeyklay opened this issue Oct 20, 2015 · 2 comments

Comments

@sergeyklay
Copy link
Member

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)
@sergeyklay
Copy link
Member Author

refs phalcon/phalcon-devtools#518

@sergeyklay
Copy link
Member Author

Fixed in #11039

pantaovay pushed a commit to pantaovay/cphalcon that referenced this issue Nov 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant