I tried to followed the codeigniter tutorail on youtube here about creating migration in codeigniter. However, I got error
No migration could be found with the version number: 1
I already set $config['migration_version'] = 1; in Application/Config/migration.php and my migration file for creating users table
Application/migrations/001_Create_User.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_Create_Users extends CI_Migration {
/*
up function is for creating and alert table
*/
public function up()
{
$this->dbforge->add_field(array(
'id' => array(
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'email' => array(
'type' => 'VARCHAR',
'constraint' => '128',
),
'password' => array(
'type' => 'VARCHAR',
'constraint' => '100',
),
));
$this->dbforge->add_key('id',TRUE);
$this->dbforge->create_table('users');
}
/*
down function for rollback table
*/
public function down()
{
$this->dbforge->drop_table('users');
}
}
?>
When I check my database, I saw migration table version is always 0.
Please help me, thanks
In config/migration.php
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Default migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| If this configuration value is missing the Migration library defaults
| to 'sequential' for backward compatibility.
|
*/
$config['migration_type'] = 'sequential';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With