0

我正在尝试配置一个新的 Yii2 项目以仅使用 Redis Active Record ( http://www.yiiframework.com/doc-2.0/yii-redis-activerecord.html ) 工作。不像常规数据库那样支持Redis 。

我的迁移将设置应用程序的第一个用户。它不是试图改变数据库模式。Yii2可以吗?或者我必须配置一个什么都不做的sqlite db?

文档中没有类似的东西。并且任何迁移都会扩展 yii\db\Migration(在初始化期间尝试配置数据库)。

任何解决方法?

toctoc (master)$ ./yii migrate/up

回报:

Yii Migration Tool (based on Yii v2.0.6)

Exception 'ReflectionException' with message 'Class db does not exist'

in toctoc/vendor/yiisoft/yii2/di/Container.php:415

Stack trace:
#0 toctoc/vendor/yiisoft/yii2/di/Container.php(415): ReflectionClass->__construct('db')
#1 toctoc/vendor/yiisoft/yii2/di/Container.php(358): yii\di\Container->getDependencies('db')
#2 toctoc/vendor/yiisoft/yii2/di/Container.php(151): yii\di\Container->build('db', Array, Array)
#3 toctoc/vendor/yiisoft/yii2/di/Instance.php(154): yii\di\Container->get('db')
#4 toctoc/vendor/yiisoft/yii2/di/Instance.php(128): yii\di\Instance->get(NULL)
#5 toctoc/vendor/yiisoft/yii2/console/controllers/MigrateController.php(95): yii\di\Instance::ensure('db', 'yii\\db\\Connecti...')
#6 toctoc/vendor/yiisoft/yii2/base/Controller.php(149): yii\console\controllers\MigrateController->beforeAction(Object(yii\base\InlineAction))
#7 toctoc/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction('up', Array)
#8 toctoc/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction('up', Array)
#9 toctoc/vendor/yiisoft/yii2/console/Application.php(167): yii\base\Module->runAction('migrate/up', Array)
#10 toctoc/vendor/yiisoft/yii2/console/Application.php(143): yii\console\Application->runAction('migrate/up', Array)
#11 toctoc/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#12 toctoc/yii(19): yii\base\Application->run()
#13 {main}
4

0 回答 0