Commit e1c36ace authored by Bart Visscher's avatar Bart Visscher

Code the primary key ordering so it works with sqlite before version 3.7.16

parent 30b286cd
...@@ -166,9 +166,12 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -166,9 +166,12 @@ class SqliteSchemaManager extends AbstractSchemaManager
// fetch primary // fetch primary
$stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')"); $stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC); $indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
usort($indexArray, function($a, $b) {
return $a['pk'] - $b['pk'];
});
foreach ($indexArray as $indexColumnRow) { foreach ($indexArray as $indexColumnRow) {
if ($indexColumnRow['pk'] != "0") { if ($indexColumnRow['pk'] != "0") {
$indexBuffer[$indexColumnRow['pk']] = array( $indexBuffer[] = array(
'key_name' => 'primary', 'key_name' => 'primary',
'primary' => true, 'primary' => true,
'non_unique' => false, 'non_unique' => false,
...@@ -176,7 +179,6 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -176,7 +179,6 @@ class SqliteSchemaManager extends AbstractSchemaManager
); );
} }
} }
ksort($indexBuffer);
// fetch regular indexes // fetch regular indexes
foreach ($tableIndexes as $tableIndex) { foreach ($tableIndexes as $tableIndex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment