我希望hivemind有一些关于从Yii Framework处理这个错误的建议.我们设置的具体错误是:
CDbException The table “users” for active record class “Users”
cannot be found in the database.
我正在使用来自SVN的Yii Framework 1.1.11-dev,尽管这只是尝试解决问题.我们运行的是最新的稳定版本1.1.10.
我们正尝试使用在我的开发环境中运行的代码部署到我们的实时服务器.我觉得问题几乎肯定是数据库配置的差异,但我不知道在哪里可以找到它.
我已经在这里搜索并搜索了Yii论坛,在那里我发现了这个问题几次.我们已经尝试过的建议修复包括
>从dsn中删除主机和端口
>有和没有表名的模式(即“users”和“public.users”)
>授予所有数据库[dbname]至postgres
>使用找到的代码here在数据库中的每个表上全部授予
环境如下:
> DEV – OSX 10.7,PHP 5.3.10,Postgresql 9.0.3
> PROD – FC15,Postgresql 9.0.7
~$psql -U postgres psql (9.0.7) Type "help" for help. postgres=# \dt List of relations Schema | Name | Type | Owner --------+------------------------------+-------+---------- { ... removed for brevity ... } public | users | table | postgres
我们在protected / config / main.PHP中的配置
'db'=>array( 'connectionString' => 'pgsql:dbname=lppsync','emulatePrepare' => true,'username' => 'postgres','password' => '',),
而Users模型的相关部分是
class Users extends CActiveRecord { /** * Returns the static model of the specified AR class. * @param string $className active record class name. * @return Users the static model class */ public static function model($className=__CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return 'users'; }