[eluser]cerberus478[/eluser]
I'm doing a tutorial on migration and for some reason I'm getting this error
Quote:Error Number: 1146
Table 'demo.ci_sessions' doesn't exist
INSERT INTO `ci_sessions` (`session_id`, `ip_address`, `user_agent`, `last_activity`, `user_data`) VALUES ('0cd5628dee526ad05f2b2aaa7d13a35c', '::1', 'Mozilla/5.0 (Windows NT 6.0; rv:25.0) Gecko/20100101 Firefox/25.0', 1384368848, '')
Filename: C:\wamp\www\afishinsea\system\database\DB_driver.php
Line Number: 330
This is my controller
Code:
<?php
class Migration extends Admin_Controller
{
public function __construct ()
{
parent::__construct();
}
public function index ()
{
$this->load->library('migration');
if (! $this->migration->current()) {
show_error($this->migration->error_string());
}
else {
echo 'Migration worked!';
}
}
}
and this is the migration php file, its located in the migrations folder that I created
Code:
<?php
class Migration_Create_Sessions extends CI_Migration {
public function up()
{
$fields = array(
'session_id VARCHAR(40) DEFAULT \'0\' NOT NULL',
'ip_address VARCHAR(45) DEFAULT \'0\' NOT NULL',
'user_agent VARCHAR(120) NOT NULL',
'last_activity INT(10) unsigned DEFAULT 0 NOT NULL',
'user_data text NOT NULL'
);
$this->dbforge->add_field($fields);
$this->dbforge->add_key('session_id', TRUE);
$this->dbforge->create_table('ci_sessions');
$this->db->query('ALTER TABLE `ci_sessions` ADD KEY `last_activity_idx` (`last_activity`)');
}
public function down()
{
$this->dbforge->drop_table('ci_sessions');
}
}