| @@ 147-160 (lines=14) @@ | ||
| 144 | * @param string $migration |
|
| 145 | * @param int $batch |
|
| 146 | */ |
|
| 147 | protected function runUp($migration, $batch) |
|
| 148 | { |
|
| 149 | $migrationClass = $this->resolveMigrationClass($migration); |
|
| 150 | ||
| 151 | try { |
|
| 152 | $migrationClass->up($this->connection); |
|
| 153 | } catch (\Exception $e) { |
|
| 154 | return $this->log("<error>{$e->getMessage()}</error>"); |
|
| 155 | } |
|
| 156 | ||
| 157 | $this->log("<info>Migrated {$migration}.</info>"); |
|
| 158 | ||
| 159 | $this->repository->insertRecord($migration, $batch); |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * Resolve the migration class from the file name. |
|
| @@ 225-238 (lines=14) @@ | ||
| 222 | * |
|
| 223 | * @param string $migration |
|
| 224 | */ |
|
| 225 | protected function runDown($migration) |
|
| 226 | { |
|
| 227 | $migrationClass = $this->resolveMigrationClass($migration); |
|
| 228 | ||
| 229 | try { |
|
| 230 | $migrationClass->down($this->connection); |
|
| 231 | } catch (\Exception $e) { |
|
| 232 | return $this->log("<error>{$e->getMessage()}</error>"); |
|
| 233 | } |
|
| 234 | ||
| 235 | $this->log("<info>Rolled back {$migration}.</info>"); |
|
| 236 | ||
| 237 | $this->repository->deleteRecord($migration); |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * Reset the database by rolling back all migrations. |
|