【发布时间】:2018-09-12 16:40:21
【问题描述】:
我知道迁移是如何工作的,并且之前已经创建了迁移文件, 所以我像这样创建了我的迁移文件:
php yii migrate/create implants_type
它给了我:
<?php
use yii\db\Migration;
class m180403_081742_implants_type extends Migration
{
public function up()
{
}
public function down()
{
echo "m180403_081742_implants_type cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
然后
php yii migrate/create create_implants_type_table
我更新了这样生成的文件:
<?php
use yii\db\Migration;
class m180403_081750_create_implants_type_table extends Migration
{
public function up()
{
$this->createTable('implants_type_table', [
'id' => $this->primaryKey(),
'implants_name'=>$this->string(),
]);
}
public function down()
{
$this->dropTable('implants_type_table');
}
}
然后我用了
./yii migrate
但发生错误:
异常 'yii\base\UnknownPropertyException' 带有消息 'Setting unknown property: yii\caching\FileCache::backuprestore'
我现在更新了我的作曲家,问题仍然存在。
【问题讨论】:
-
你为什么不使用 php yii migrate ?
-
您编写的迁移没有任何问题。检查缓存配置
-
@mrateb 了解git-scm.com plz!
标签: php yii2 migration database-migration yii2-advanced-app