Missed index type on Phalcon\Db\Adapter\Pdo\Sqlite::describeIndexes #10997
Closed
Description
How to reproduce:
SH
sqlite3 test1.db
SQL
CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL
);
CREATE INDEX salary_index ON COMPANY (salary);
CREATE UNIQUE INDEX name_index ON COMPANY (name);
PHP
<?php
use Phalcon\Db\Adapter\Pdo\Sqlite;
$connection = new Sqlite(['dbname' => dirname(__FILE__) . '/test1.db']);
$indexes = $connection->describeIndexes('company');
echo print_r($indexes, true), PHP_EOL;
Actual
Array
(
[name_index] => Phalcon\Db\Index Object
(
[_name:protected] => name_index
[_columns:protected] => Array
(
[0] => NAME
)
[_type:protected] =>
)
[salary_index] => Phalcon\Db\Index Object
(
[_name:protected] => salary_index
[_columns:protected] => Array
(
[0] => SALARY
)
[_type:protected] =>
)
[sqlite_autoindex_COMPANY_1] => Phalcon\Db\Index Object
(
[_name:protected] => sqlite_autoindex_COMPANY_1
[_columns:protected] => Array
(
[0] => ID
)
[_type:protected] =>
)
)
Expected
Array
(
[name_index] => Phalcon\Db\Index Object
(
[_name:protected] => name_index
[_columns:protected] => Array
(
[0] => NAME
)
[_type:protected] => 'PRIMARY'
)
[salary_index] => Phalcon\Db\Index Object
(
[_name:protected] => salary_index
[_columns:protected] => Array
(
[0] => SALARY
)
[_type:protected] =>
)
[sqlite_autoindex_COMPANY_1] => Phalcon\Db\Index Object
(
[_name:protected] => sqlite_autoindex_COMPANY_1
[_columns:protected] => Array
(
[0] => ID
)
[_type:protected] => 'UNIQUE'
)
)
SQLite
.header on
.mode column
.width 26 8 48
SELECT name, rootpage, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = 'COMPANY';
name rootpage sql
-------------------------- -------- ------------------------------------------------
sqlite_autoindex_COMPANY_1 3
salary_index 6 CREATE INDEX salary_index ON COMPANY (salary)
name_index 7 CREATE UNIQUE INDEX name_index ON COMPANY (name)
Metadata
Assignees
Labels
No labels