1
0
Fork 0
mirror of https://github.com/Oreolek/kohana-migrations.git synced 2024-06-26 03:40:54 +03:00

table name with prefix also in checking query

This commit is contained in:
f1ames 2014-02-26 09:40:16 +01:00
parent 5ffab5e738
commit 5d1e612515

View file

@ -167,12 +167,13 @@ class Model_Minion_Migration extends Model
*/ */
public function ensure_table_exists() public function ensure_table_exists()
{ {
$query = $this->_db->query(Database::SELECT, "SHOW TABLES like '".$this->_table."'"); $table = $this->_db->table_prefix() . $this->_table;
$query = $this->_db->query(Database::SELECT, "SHOW TABLES like '".$table."'");
if ( ! count($query)) if ( ! count($query))
{ {
$sql = View::factory('minion/task/migrations/schema') $sql = View::factory('minion/task/migrations/schema')
->set('table_name', $this->_db->table_prefix() . $this->_table) ->set('table_name', $table)
->render(); ->render();
$this->_db->query(NULL, $sql); $this->_db->query(NULL, $sql);