diff --git a/src/Migrate/Migrator.php b/src/Migrate/Migrator.php index 80a679c..611e79e 100644 --- a/src/Migrate/Migrator.php +++ b/src/Migrate/Migrator.php @@ -184,7 +184,7 @@ public function markVersion($version) if ($status->isApplied()) { $this->logger->log("version already migrated: $version"); - } elseif ($status->hasContent() == false) { + } elseif ($status->isMissing()) { $this->logger->log("mark version: $version is missing"); } else { $this->adapter->save($version, $status->getContent()); @@ -199,8 +199,8 @@ public function markAllVersions() foreach ($statuses as $version => $status) { if ($status->isApplied()) { // skip - } elseif ($status->hasContent() == false) { - $this->logger->log("mark version: $version is missing"); + } elseif ($status->isMissing()) { + // skip } else { $this->adapter->save($version, $status->getContent()); $this->logger->log("mark version: $version"); diff --git a/src/Migrate/Status.php b/src/Migrate/Status.php index 785c305..335a2bd 100644 --- a/src/Migrate/Status.php +++ b/src/Migrate/Status.php @@ -1,6 +1,8 @@ source === null) { if ($this->script !== null) { - $this->source = file_get_contents($this->script); + $source = file_get_contents($this->script); + if ($source === false) { + throw new RuntimeException("Unable read \"$this->script\""); + } + $this->source = $source; }; } - if ($this->source !== false && $this->source !== null) { + if ($this->source !== null) { return $this->source; } else { return $this->content;