I just started working with CodeIgniter 3, I understand that it is already outdated, but the task is set to work with it. And I immediately had a problem, rummaged through the Internet and did not find an answer.
It seems to me that I am just missing a small detail. Please help guide me on the true path.
Migration:
class Migration_Add_blog extends CI_Migration {
public function up()
{
$this->dbforge->add_field(array(
'id' => array(
'type' => 'INT',
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'title' => array(
'type' => 'TEXT',
'null' => TRUE,
),
));
$this->dbforge->add_key('id', TRUE);
$this->dbforge->create_table('blog');
}
Migrate.php
public function index()
{
$this->load->library('migration');
if (!$this->migration->version(1))
{
show_error($this->migration->error_string());
}
}
migration.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['migration_enabled'] = TRUE;
$config['migration_type'] = 'sequential';
$config['migration_table'] = 'migrations';
$config['migration_auto_latest'] = FALSE;
$config['migration_version'] = 1;
$config['migration_path'] = APPPATH.'migrations/';
My Error:
The migration class "Migration_Add_blog" is missing an "up" method.
if ($this->migration->current() === FALSE){ show_error($this->migration->error_string()); }
not the version one, maybe the migration is past 1 – Paranoia