Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Corrected fake action; added upgrade action
Browse files Browse the repository at this point in the history
  • Loading branch information
Bishop committed Jul 18, 2012
1 parent d259747 commit 656f0a0
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions classes/controller/migrate.php
Expand Up @@ -104,13 +104,35 @@ public function action_fake()
{
$migrations = $this->runner->enumerateUpMigrations();

$migration = array_pop($migrations);
foreach ($migrations as $migration)
{
$this->runner->setSchemaVersion(
$this->runner->migrationNameToVersion($migration)
);
}

print "==[ READY ]==\n";
}

print "==[ $migration ]==\n";
/**
* Mark all prev migrations as completed
*/
public function action_upgrade()
{
$current_version = $this->runner->getSchemaVersion();
$migrations = $this->runner->enumerateMigrations();

foreach ($migrations as $migration)
{
$version = $this->runner->migrationNameToVersion($migration);

if ($version < $current_version)
{
$this->runner->setSchemaVersion($version);
}
}

$this->runner->setSchemaVersion(
$this->runner->migrationNameToVersion($migration)
);
print "==[ READY ]==\n";
}

public function action_print()
Expand Down

0 comments on commit 656f0a0

Please sign in to comment.