/** * Get the path to an extension's published asset. * * @param Extension $extension * @param string $path * @return string */ public function getAsset(Extension $extension, $path) { return $this->app->basePath() . '/assets/extensions/' . $extension->getId() . $path; }
/** * Run "down" a migration instance. * * @param $path * @param string $file * @param string $path * @param Extension $extension * @return void */ protected function runDown($path, $file, Extension $extension = null) { $migration = $this->resolve($path, $file); $this->runClosureMigration($migration, 'down'); // Once we have successfully run the migration "down" we will remove it from // the migration repository so it will be considered to have not been run // by the application then will be able to fire by any later operation. $this->repository->delete($file, $extension ? $extension->getId() : null); $this->note("<info>Rolled back:</info> {$file}"); }
/** * Runs the database migrations to reset the database to its old state. * * @param Extension $extension */ public function migrateDown(Extension $extension) { $this->migrate($extension->getId(), false); }
/** * Rolls all of the currently applied migrations back. * * @param string $path * @param Extension $extension * @return int */ public function reset($path, Extension $extension = null) { $this->notes = []; $migrations = array_reverse($this->repository->getRan($extension->getId())); $this->requireFiles($path, $migrations); $count = count($migrations); if ($count === 0) { $this->note('<info>Nothing to rollback.</info>'); } else { foreach ($migrations as $migration) { $this->runDown($migration, $extension); } } return $count; }