I’m getting quite a strange error when trying to use schema caching:
CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 table YiiCache already existsCREATE TABLE YiiCache ( id CHAR(128) PRIMARY KEY, expire INTEGER, value BLOB )
Deletion of the cache table solves the problem (kind of). At first I couldn’t figure out what triggered the error. Sometimes it would happen in the yiic shell and sometimes when interacting with the database via the web app, but then I realized that if the cache was (re-)created in the shell, it would not work in the web app, and vice versa.
So… steps (ERRORZ = above error):
$ protected/yiic shell >> $u = new User; ERRORZ $ rm protected/runtime/cache-1.0.10.db $ protected/yiic shell >> $u = new User; SUCCESS (visits web page) ERRORZ $ rm protected/runtime/cache-1.0.10.db (visits web page) SUCCESS $ protected/yiic shell >> $u = new User; ERRORZ
Here’s (parts of) my config:
'db'=>array( 'connectionString'=>'mysql:host=127.0.0.1;dbname=ntc', 'username' => '...', 'password' => '...', 'schemaCacheID' => 'schemaCache', 'schemaCachingDuration' => 3600,), 'schemaCache' => array( 'class' => 'CDbCache', ),
So what I’m wondering is if this is intentional behaviour and I’m doing something wrong or if I’ve stumbled upon a bug?
I’m using Yii 1.0.10, by the way.