Cake\Database\Schema\SqliteSchema::convertIndexDescription PHP Method

convertIndexDescription() public method

Since SQLite does not have a way to get metadata about all indexes at once, additional queries are done here. Sqlite constraint names are not stable, and the names for constraints will not match those used to create the table. This is a limitation in Sqlite's metadata features.
public convertIndexDescription ( Table $table, $row )
$table Table
    public function convertIndexDescription(Table $table, $row)
    {
        $sql = sprintf('PRAGMA index_info(%s)', $this->_driver->quoteIdentifier($row['name']));
        $statement = $this->_driver->prepare($sql);
        $statement->execute();
        $columns = [];
        foreach ($statement->fetchAll('assoc') as $column) {
            $columns[] = $column['name'];
        }
        $statement->closeCursor();
        if ($row['unique']) {
            $table->addConstraint($row['name'], ['type' => Table::CONSTRAINT_UNIQUE, 'columns' => $columns]);
        } else {
            $table->addIndex($row['name'], ['type' => Table::INDEX_INDEX, 'columns' => $columns]);
        }
    }