public function add(AbstractMigration $migration) { $version = $migration->getVersion(); if (array_key_exists($version, $this->migrations)) { throw new InvalidStateException("2 migrations with same version '{$version}' detected"); } $this->migrations[$version] = $migration; ksort($this->migrations); }
public function log(AbstractMigration $migration, $timestamp) { $datetime = new \DateTime(); $this->connection->insert($this->table, ['version' => $migration->getVersion(), 'executed' => $datetime->setTimestamp($timestamp)])->execute(); }