mirror of
https://github.com/Oreolek/kohana-migrations.git
synced 2024-05-24 11:58:11 +03:00
Merge pull request #20 from sittercity/develop
Add config option to hard prevent migrations before a certain date from r
This commit is contained in:
commit
89932a9417
|
@ -132,6 +132,15 @@ class Minion_Migration_Manager {
|
|||
|
||||
foreach ($migrations as $migration)
|
||||
{
|
||||
if ($method == 'down' AND $migration['timestamp'] <= Kohana::config('minion/migration')->lowest_migration)
|
||||
{
|
||||
Minion_CLI::write(
|
||||
'You\'ve reached the lowest migration allowed by your config: '.Kohana::config('minion/migration')->lowest_migration,
|
||||
'red'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$filename = Minion_Migration_Util::get_filename_from_migration($migration);
|
||||
|
||||
if ( ! ($file = Kohana::find_file('migrations', $filename, FALSE)))
|
||||
|
@ -164,7 +173,7 @@ class Minion_Migration_Manager {
|
|||
|
||||
if ($this->_dry_run)
|
||||
{
|
||||
$this->_dry_run_sql[$path][$migration['timestamp']] = $db->reset_query_stack();
|
||||
$this->_dry_run_sql[$migration['group']][$migration['timestamp']] = $db->reset_query_stack();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -444,6 +444,12 @@ class Model_Minion_Migration extends Model
|
|||
return array(NULL, $up);
|
||||
}
|
||||
|
||||
return array((string) $query->execute($this->_db)->get('timestamp'), $up);
|
||||
// Seek to the requested row
|
||||
for ($i = 0; $i < $amount - 1; $i++)
|
||||
{
|
||||
$results->next();
|
||||
}
|
||||
|
||||
return array((string) $results->get('timestamp'), $up);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,4 +6,11 @@ return array(
|
|||
'group_connection' => array(
|
||||
|
||||
),
|
||||
/**
|
||||
* This specifies which migration should be the "base", in timestamp form.
|
||||
* This migration will not be run when --migrate-down is called
|
||||
*
|
||||
* NULL means all migrations will run
|
||||
*/
|
||||
'lowest_migration' => NULL,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue