yii - Gii 模型生成器不会让我创建模型。(抛出表“作者”不存在)
问题描述
我为作者表创建了一个迁移。
public function up()
{
$this->createTable('authors', [
'id' => $this->primaryKey(),
'name' => $this->string()->notNull()
]);
}
public function down()
{
$this->dropTable('authors');
}
迁移表后,我想为迁移制作模型。所以尝试使用 gii 创建模型,这就是我得到的。
表作者已由迁移创建,但 gii 模型生成器仍然显示表“作者”不存在。还有什么我想念的吗?
这是我的 db.php 文件
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=myFirstYii',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
// Schema cache options (for production environment)
//'enableSchemaCache' => true,
//'schemaCacheDuration' => 60,
//'schemaCache' => 'cache',
];
解决方案
推荐阅读
- python - python azure sdk - 克隆服务器
- android - 项目选项卡卡在加载屏幕上 如何查看左侧的项目文件夹?
- laravel - laravel 邮件门面队列功能将邮件发送到错误的邮件主机
- eclipse-emf - 设置 EMF EObject 的父级
- macos - 带有 AudioFileID 和加密文件的音频单元文件阅读器
- reactjs - realm.objects(databaseName) 总是返回数组类型的结果,但我正在寻找返回对象而不是数组的东西
- r - R:识别异常值并在箱线图中标记它们
- gremlin - Gremlin,按边属性分组
- html - 从另一个页面更改 iframe
- azure - 是否可以(通过不同的支持)将 Azure 驱动器附加到 Azure 应用服务实例?