Clear cache after extension creates new database fields?

Hi

If my extension creates/updates the database with new fields for the model. Do i need to clear the caches to get the changes to work? Just wondering how I'd go about doing that in my beforeEnable etc... methods.

Cheers!

Elliot
 
Do i need to clear the caches to get the changes to work?
Yes you do, when you want to flush all the caches, call:
PHP:
// clean directories of old asset files.
FileSystemHelper::clearCache();

// remove the cache, can be redis for example
Yii::app()->cache->flush();

// rebuild the tables schema cache
Yii::app()->db->schema->getTables();
Yii::app()->db->schema->refresh();
In your case, for database, you just need:
PHP:
// rebuild the tables schema cache
Yii::app()->db->schema->getTables();
Yii::app()->db->schema->refresh();
 
Back
Top