我尝试将新的Yii2项目配置为仅使用Redis Active Record(http://www.yiiframework.com/doc-2.0/yii-redis-activerecord.html)。 Redis不像常规数据库那样支持。
我的迁移将设置应用程序的第一个用户。它没有尝试改变数据库模式。 Yii2有可能吗?或者我必须配置一个不会做任何事情的sqlite数据库?
文档中没有任何类似内容。任何迁移都扩展了yii \ db \ Migration(尝试在init期间配置数据库)。
任何解决方法?
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}