As seen on "How do I run CodeIgniter migrations?" I created the following migration controller:
class Migrate extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->input->is_cli_request()
or exit("Execute via command line: php index.php migrate");
$this->load->library('migration');
}
public function index()
{
if(!$this->migration->latest())
{
show_error($this->migration->error_string());
}
}
}
And the following migration script under migrations/001_CreateUserTable
:
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_CreateUserTable extends CI_Migration
{
private $table='user';
public function up()
{
$this->dbforge->add_field('id INT UNSIGNED NOT NULL AUTO INCREMENT')
->add_field('username VARCHAR(30) NOT NULL')
->add_field('password VARCHAR(200) NOT NULL');
$this->dbforge->add_key('id',true);
$this->dbforge->create_table($this->table);
}
public function down()
{
$this->dbforge->drop_table($this->table);
}
}
But when I run on my command line interface:
php index.php migrate
I receive the following error:
ERROR: An Error Was Encountered
Migrations has been loaded but is disabled or set up incorrectly.
Do you have any sort of idea hot to fix it?
Edit 1
On application/config
I set the $config['migration_enabled']=true;
value still no result.