找不到具有以下版本号的迁移:1 [英] No migration could be found with the version number: 1
本文介绍了找不到具有以下版本号的迁移:1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图遵循youtube上的codeigniter tutorail 此处关于在codeigniter中创建迁移。但是,我遇到了错误
I tried to followed the codeigniter tutorail on youtube here about creating migration in codeigniter. However, I got error
找不到版本号为1的迁移
No migration could be found with the version number: 1
我已经设置了 $ config ['migration_version'] = 1 ;在Application / Config / migration.php和用于创建用户表的迁移文件中
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');
}
}
?>
当我检查数据库时,看到迁移表的版本始终为0。
When I check my database, I saw migration table version is always 0.
请帮助我,谢谢
推荐答案
在config / migration.php
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';
这篇关于找不到具有以下版本号的迁移:1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文