コード例 #1
0
 /**
  * Runs all of the migrations in reverse order, until they have
  * all been un-applied.
  */
 public function rollback()
 {
     CLI::write("Rolling back all migrations...", 'yellow');
     try {
         $this->runner->version(0);
     } catch (\Exception $e) {
         $this->showError($e);
     }
     CLI::write('Done');
 }
コード例 #2
0
 /**
  * Ensures that the database is cleaned up to a known state
  * before each test runs.
  *
  * @throws ConfigException
  */
 public function setUp()
 {
     $this->loadDependencies();
     if ($this->refresh === true) {
         if (!empty($this->basePath)) {
             $this->migrations->setPath(rtrim($this->basePath, '/') . '/migrations');
         }
         $this->db->table('migrations')->truncate();
         $this->migrations->version(0, 'tests');
         $this->migrations->latest('tests');
     }
     if (!empty($this->seed)) {
         if (!empty($this->basePath)) {
             $this->seeder->setPath(rtrim($this->basePath, '/') . '/seeds');
         }
         $this->seed($this->seed);
     }
 }