Skip to content

Commit

Permalink
Explicitly set the fetch mode on SELECT queries to avoid error when p…
Browse files Browse the repository at this point in the history
…roject users a different fetch mode
  • Loading branch information
AllenJB committed Mar 16, 2018
1 parent fcb4eb2 commit f2f1c81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function lock() : bool
}

$sql = "SELECT * FROM `{$this->tableName}` WHERE dt_finished IS NULL AND `name` != '/lock'";
$rs = $this->db->query($sql);
$rs = $this->db->query($sql, \PDO::FETCH_OBJ);
if ($rs->rowCount() > 0) {
$firstEntry = $rs->fetch();
throw new MigrationLockException("An unfinished migration was detected. Manual intervention required: ". $firstEntry->name);
Expand Down Expand Up @@ -189,7 +189,7 @@ protected function loadMigrations() : void
protected function loadExecutedMigrations() : void
{
$sql = "SELECT * FROM `{$this->tableName}` ORDER BY dt_finished ASC";
$rs = $this->db->query($sql);
$rs = $this->db->query($sql, \PDO::FETCH_OBJ);
foreach ($rs as $entry) {
if ($entry->name === '/lock') {
continue;
Expand Down

0 comments on commit f2f1c81

Please sign in to comment.