From 64d87e1be9577f267b801dfe3b5fbe25fcd1a8ab Mon Sep 17 00:00:00 2001 From: Jeremy Bush Date: Thu, 12 May 2011 14:14:09 -0500 Subject: [PATCH] Add config option to hard prevent migrations before a certain date from running --- classes/minion/migration/manager.php | 9 +++++++++ config/minion/migration.php | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/classes/minion/migration/manager.php b/classes/minion/migration/manager.php index 2c41ead..95abc8f 100644 --- a/classes/minion/migration/manager.php +++ b/classes/minion/migration/manager.php @@ -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))) diff --git a/config/minion/migration.php b/config/minion/migration.php index 0009457..5f16a12 100644 --- a/config/minion/migration.php +++ b/config/minion/migration.php @@ -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, );