Commit 18cbfdcf authored by Bart Visscher's avatar Bart Visscher

Make the column more predictable

Take the column order into account and sort non PK columns last
parent cdd2d49c
......@@ -167,6 +167,15 @@ class SqliteSchemaManager extends AbstractSchemaManager
$stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')");
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
usort($indexArray, function($a, $b) {
if ($a['pk'] == $b['pk']) {
return $a['cid'] - $b['cid'];
}
if ($a['pk'] == "0" && $b['pk'] != "0") {
return 1;
}
if ($a['pk'] != "0" && $b['pk'] == "0") {
return -1;
}
return $a['pk'] - $b['pk'];
});
foreach ($indexArray as $indexColumnRow) {
......
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