diff --git a/classes/Model/Minion/Migration.php b/classes/Model/Minion/Migration.php index 32e5bcd..f861d2c 100644 --- a/classes/Model/Minion/Migration.php +++ b/classes/Model/Minion/Migration.php @@ -15,7 +15,7 @@ class Model_Minion_Migration extends Model * The table that's used to store the migrations * @var string */ - protected $_table = 'minion_migrations'; + protected $_table; /** * Constructs the model, taking a Database connection as the first and only @@ -26,6 +26,8 @@ class Model_Minion_Migration extends Model public function __construct(Kohana_Database $db) { $this->_db = $db; + + $this->_table = Kohana::$config->load('minion/migration.table'); } /** @@ -170,7 +172,9 @@ class Model_Minion_Migration extends Model if ( ! count($query)) { - $sql = file_get_contents(Kohana::find_file('', 'minion_schema', 'sql')); + $sql = View::factory('minion/task/migrations/schema') + ->set('table_name', $this->_table) + ->render(); $this->_db->query(NULL, $sql); } diff --git a/config/minion/migration.php b/config/minion/migration.php index 32c869d..cba92c5 100644 --- a/config/minion/migration.php +++ b/config/minion/migration.php @@ -7,6 +7,11 @@ return array( ), + /** + * The table used to store migrations + */ + 'table' => 'minion_migrations', + /** * This specifies which migration should be the "base", in timestamp form. * This migration will not be run when --migrate-down is called diff --git a/minion_schema.sql b/minion_schema.sql deleted file mode 100644 index f4b42d8..0000000 --- a/minion_schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE `minion_migrations` ( - `timestamp` varchar(14) NOT NULL, - `description` varchar(100) NOT NULL, - `group` varchar(100) NOT NULL, - `applied` tinyint(1) DEFAULT '0', - PRIMARY KEY (`timestamp`,`group`), - UNIQUE KEY `MIGRATION_ID` (`timestamp`,`description`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/views/minion/task/migrations/schema.php b/views/minion/task/migrations/schema.php new file mode 100644 index 0000000..519f4ea --- /dev/null +++ b/views/minion/task/migrations/schema.php @@ -0,0 +1,8 @@ +CREATE TABLE `` ( + `timestamp` varchar(14) NOT NULL, + `description` varchar(100) NOT NULL, + `group` varchar(100) NOT NULL, + `applied` tinyint(1) DEFAULT '0', + PRIMARY KEY (`timestamp`,`group`), + UNIQUE KEY `MIGRATION_ID` (`timestamp`,`description`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8;