[eluser]Stolz[/eluser]
Hi,
I'm trying to use the Migration library available in the develop branch of GitHub. I've set everything and my migration files are executed, but when I try to run a query in the migration file I get the error
Code:
Call to a member function query() on a non-object in...
My controller
Code:
$this->load->library('migration');
if( ! $this->migration->version(1))
echo $this->migration->error;
Content of 001_Testing.php file
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Migration_Testing{
function up()
{
$this->db->query('CREATE TABLE IF NOT EXISTS testings_migrations (some_column int(5) NULL)');
}
function down()
{
$this->db->query('DROP TABLE IF EXISTS testings_migrations');
}
}
How can I access the CI super-global object inside the migration files?. I've already tried with the usual
$CI =& get_instance(); but no luck.
EDIT
Nevermind, I figure it out. Migration_Testing class needs to extend CI_Migration.