示例#1
0
 public function up()
 {
     require $this->fileInfo->__toString();
     $migrationName = $this->getName();
     $this->container->create($migrationName)->up();
     $this->adapter->initialize();
     $this->adapter->up($this->getId(), file_get_contents($this->fileInfo));
 }
示例#2
0
 /**
  * @return array|\Wandu\Database\Migrator\MigrationContainer[]
  */
 public function migrate()
 {
     $migratedMigrations = [];
     $migrations = $this->getMigrations();
     foreach ($migrations as $migration) {
         if (!$this->adapter->version($migration->getId())) {
             $migration->up();
             $migratedMigrations[] = $migration;
         }
     }
     return $migratedMigrations;
 }